Issue in W3CWebSocket constructor
ibc opened this issue · comments
Iñaki Baz Castillo commented
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.
Iñaki Baz Castillo commented
PR in #174