-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AF_UNIX missing in namespace tjs #512
Comments
I didn't implement a helper and the constant because it seemed more useful to use the normal streaming tjs socket for that. It was a generic implementation for any kind of sockets. E.g. I use it for raw sockets. |
What's your application using the PosixSocket btw? |
I am using a file via UNIX Domain Sockets in streaming mode to share information with limited overhead between local processes and with external clients via a websockets bridge. |
Any reason not to use the builtin |
I am not sure I am following. The builtin connect is built around AF_INET, requiring an address and port. IPC with Unix Domain Sockets uses only a "filename" as address, The socket address type is just not the same. To explain it better, I was forced to write something like
It should be
|
Ah I get it, it is called pipe internally in this implementation. |
It's a normal Unix domain socket, represented by a file. Abstract sockets are not currently supported. |
Yes, I was not planning on using them. |
It would be nice if they work in the low level, I guess @lal12 didn't implement them because it wasn't necessary at the time. In general the high level implementation is preferred, as it's cross-platform. |
As far as I know, the abstract variant is a linux specific extension. So it is unlikely they can be made cross-platform, but I don't know enough about windows to tell. Also, my understanding from the code is that pipes are assuming a stream-based connection. However Unix Domain Sockets would also allow for packet and sequence packet in place of SOCK_STREAM. |
I mean Unix sockets / windows named pipes, not the abstract variant specifically.
Correct, I missed to point that out. The libuv API which txiki.js wraps is only for streams. |
I see. In principle, would you accept PR on what discussed so far? More in general, is there any roadmap or policy about what is suitable for this project and what is not, aside from what reported in #418? I am extending txiki quite a bit since I am adopting it as the runtime for an embedded application. A few of these features would make sense to be here in upstream, but without discussions enabled in this repo I would have to abuse pr or issues. |
Sure!
No, I go by feeling :-)
Oh, right! I just enabled discussions, thanks for the heads up! Let;s discuss each individual change, thanks for your willingness to contribute! |
No problem going by feeling, I just wanted to make sure I was not missing anything obvious as I usually do :D. |
I believe this one if fixed now, right? |
No, AF_UNIX isn't exposed if you mean that. |
Unlike other socket related constants, this is missing.
In general it seems like the library is only focusing on the INET family.
Still, Unix Domain Sockets are working as expected once properly configured, so there is no specific reason to not support them I think.
Also, it would be nice to have js helpers to construct the addr structs.
At the moment we are forced to manually construct the Uint8Array, which works but it is a bit inconvenient.
In case, I can do it.
The text was updated successfully, but these errors were encountered: