Skip to content
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

feat: unix sockets #1094

Closed
wants to merge 3 commits into from
Closed

feat: unix sockets #1094

wants to merge 3 commits into from

Conversation

YoDaMa
Copy link
Contributor

@YoDaMa YoDaMa commented May 8, 2020

Related to: #1040
This PR is still in the works, but carrys over from @ralight's PR for Unix Domain Sockets support for MQTT.js. I see there is lots of discussion around MQTT.js in Mosquitto that @ralight has participated in, and the resolution was something along the lines of, there is an actionable and useful security gain for having unix domain socket support for a service like mosquitto, so they are looking to add it.

From the MQTT.js perspective, this should be a minimal change. This PR is not complete quite yet, I think I have added some of the changes to make it work, but I want to add a unix domain sockets sample and also add the tests to support it.

For the tests, it should be very simple, just adding on a new flavor of the existing MQTT-Connection based server, except in this case listening on a unix domain port. There should be a check that the tests are running on a POSIX OS (i.e. not Windows) since obviously the tests will fail without the support of unix domain sockets on the OS.

@jdiamond
Copy link
Contributor

jdiamond commented May 8, 2020

Is file: in the URL flexible enough? It might be rare, but what if you want to use web sockets over a unix domain socket instead of plain MQTT? Or mqtts or wss?

Check out how the request library uses unix domain sockets:

https://www.npmjs.com/package/request#unix-domain-sockets

Not sure if that format is standardized and other tools use it or not.

curl supports unix sockets, too, but you use a normal URL and a separate --unix-socket option to specify the path to the socket file.

@OmgImAlexis
Copy link
Contributor

@jdiamond is right, you can use http/ws with a unix socket just the same as you can a port. So really this should just use http/ws as the protocol and then a socket or port connection should depend on the connection url as the request library does.

@ralight
Copy link
Contributor

ralight commented Mar 28, 2021

The format that the request library use is also used by nginx, so it's not exactly an uncommon format.

@YoDaMa YoDaMa closed this Feb 10, 2022
@YoDaMa YoDaMa deleted the unix-sockets branch February 10, 2022 15:21
@ralight ralight mentioned this pull request Mar 31, 2022
@natcl
Copy link

natcl commented Mar 31, 2022

Why has this been closed ?
support for unix sockets would be great !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants