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

Accept hostname lookup family option when creating WebSockets #962

Merged
merged 1 commit into from Jan 11, 2017

Conversation

hansonw
Copy link
Contributor

@hansonw hansonw commented Jan 11, 2017

http.request accepts a family option to specify the IP address family to use when resolving the server hostname. Seems pretty reasonable to accept this from the WebSocket side and forward it over to the http request call.

Specifically, this is useful for Facebook since we have IPv6 only development servers with IPv4 proxies (in which case we need websockets to connect to the IPv6 address)


it('should accept the family option', function (done) {
const wss = new WebSocketServer({ host: '::1', port: ++port }, () => {
const ws = new WebSocket(`ws://localhost:${port}`, {family: 6});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add spaces inside the options object? { family: 6 }.

it('should accept the family option', function (done) {
const wss = new WebSocketServer({ host: '::1', port: ++port }, () => {
const ws = new WebSocket(`ws://localhost:${port}`, {family: 6});
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a blank line after this?

@hansonw
Copy link
Contributor Author

hansonw commented Jan 11, 2017

Done! I think there's an eslint rule for the spaces-in-objects, btw :)

@lpinca
Copy link
Member

lpinca commented Jan 11, 2017

@hansonw yeah :) we are using semistandard and it doesn't enforce that.
We can extend it with our own rules but it kinda defeats the point of using a popular and premade config.

@lpinca lpinca merged commit fd910f1 into websockets:master Jan 11, 2017
@lpinca
Copy link
Member

lpinca commented Jan 11, 2017

Thanks!

Nibbler999 pushed a commit to Nibbler999/ws that referenced this pull request Jan 11, 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

Successfully merging this pull request may close these issues.

None yet

2 participants