channels icon indicating copy to clipboard operation
channels copied to clipboard

WebSocketBridge | Invalid WebSocket constructor TypeError

Open t-io opened this issue 9 years ago • 1 comments

I have some trouble getting the a the javascript part of channels work properly. In your documentation I read that websocketbridge.js serve as-is. So there are no other dependencies needed. I downloaded and imported the compiled version and made sure WebSocketBridge is available.

But when I trie to run this code:

const webSocketBridge = new channels.WebSocketBridge();
webSocketBridge.connect('ws://host/path?token');

I get: TypeError: Invalid WebSocket constructor. Set options.constructor

Could have something to do with this one: https://github.com/pladaria/reconnecting-websocket/issues/17 But not sure.

Frontend and Backend are separate app. Frontend uses angular 1.4.14

t-io avatar Jun 27 '17 17:06 t-io

I'm afraid I can't help you with the JS side of things, though the library still works for me so it's likely not an issue in our code. I suggest you follow the advice in the ticket you linked.

andrewgodwin avatar Jun 27 '17 17:06 andrewgodwin