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

Using ws+unix with a specific path #236

Closed
apocas opened this issue Sep 1, 2013 · 5 comments
Closed

Using ws+unix with a specific path #236

apocas opened this issue Sep 1, 2013 · 5 comments

Comments

@apocas
Copy link

apocas commented Sep 1, 2013

How can I use socketPath and simultaneously specifying an endpoint path?

Use case:
socketPath: /var/run/docker.sock
path: /container/71501a8ab0f8/attach/ws

If i do: ws+unix:///var/run/docker.sock/container/71501a8ab0f8/attach/ws it will not work because url.parse in WebSocket.js#L581 will return the full path after ws+unix://

@fearenales
Copy link

Only for further reference, a workaround for this issue is:

var url = require('url');
var WebSocket = require('ws');

var address  = url.parse('ws+unix:///var/run/docker.sock');
address.path = '/container/71501a8ab0f8/attach/ws';
var ws       = new WebSocket(address);

This works because WebSocket.js doesn't re-parse the url if it already is in a parsed object.

Tks @nuxlli

@coolaj86
Copy link
Contributor

coolaj86 commented Nov 6, 2015

request.js handles it like this:

http://unix:/absolute/path/to/unix.socket:/request/path

What do you think about a pull request that allows that format?

@alandoherty
Copy link

WebSocket still seems to try and parse it as a URL even if you url.parse beforehand, was this ever implemented?

@lpinca
Copy link
Member

lpinca commented Nov 14, 2016

Refs: #528

@lpinca
Copy link
Member

lpinca commented Feb 17, 2017

Fixed by 060b275, closing.

@lpinca lpinca closed this as completed Feb 17, 2017
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

No branches or pull requests

5 participants