Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Issue in W3CWebSocket constructor #173

Closed
ibc opened this issue Dec 2, 2014 · 1 comment
Closed

Issue in W3CWebSocket constructor #173

ibc opened this issue Dec 2, 2014 · 1 comment

Comments

@ibc
Copy link
Collaborator

ibc commented Dec 2, 2014

Hi, unfortunately some browsers (or similar devices) do not accept passing more than 2 arguments to the native WebSocket class. For example I get this error in Cordova:

Failed to construct 'WebSocket': No matching constructor signature.

This is because the official W3C WebSocket constructor just allows two arguments (WS URI and protocols), but in W3CWebSocket class we pass more arguments (those tha are useful when running in Node).

This is the way in which ws solves this problem:

https://github.com/einaros/ws/blob/master/lib/browser.js

I will apply it and send a PR.

@ibc
Copy link
Collaborator Author

ibc commented Dec 2, 2014

PR in #174

theturtle32 added a commit that referenced this issue Dec 2, 2014
W3CWebSocket: Use just one or two arguments (fixes #173)
nathaniel83 added a commit to nathaniel83/WebSocket-Node that referenced this issue Oct 3, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant