Closed baki250 closed 8 years ago
I've been dealing with the same issue - will make a pull request tonight. The problem is that the websocket is being created with an empty protocol argument (not sure if this works with other browsers, but chrome blows up for me).
Could you update bower version with that fix, please. I have had to spent quite a time trying to figure out why websocket has stoped working after switching to the bower version.
I am using the bower version, and the error keeps coming up. May i request the author to update the bower version (though it works with git version).
This is a nice wrapper and i am keen in using it.
You can fix this by passing in "subprotocol: 'base46'".
Don't ask me why this works. It just does. Maybe someone can figure it out and make a pull request so that it works with the intended 'protocols' property. ::shrug::
Well, what I do in order to fix it is just passing an empty array to the "protocols" property.
With two identical projects, the one with ng-websocket bower version 0.2.1 throws the error and the one with the actual git version works. Until the version is bumped the bower version is unusable at least in Chrome.
me.$$ws = cfg.mock ? new $$mockWebsocket(cfg.mock, $http) : new WebSocket(cfg.url, cfg.protocols);
was changed to
if (cfg.mock) {
me.$$ws = new $$mockWebsocket(cfg.mock, $http);
}
else if (cfg.protocols) {
me.$$ws = new WebSocket(cfg.url, cfg.protocols);
}
else {
me.$$ws = new WebSocket(cfg.url);
}
Just put small change to your bower.json file:
"dependencies": {
"ng-websocket": "git://github.com/wilk/ng-websocket.git#master"
}
now you have latest version in bower_components or put:
"dependencies": {
"ng-websocket": "git://github.com/wilk/ng-websocket.git#ecbdac7ec14aa0e47b9dad4cb29152c658ddaad3"
}
now you have version with this particular commit
The fix for this (for me) was: var ws = $websocket.$new({'url': 'ws://localhost:8000/foo', 'protocols': [], 'subprotocols': ['base46'] });
; subprotocols might not be needed...
This project is no longer mainteined. Sorry.
WebSocket connection to 'ws://apilocal.ws.com:8887/' failed: Error during WebSocket handshake: Sent non-empty 'Sec-WebSocket-Protocol' header but no response was received
Has anyone had this issue?