phoboslab / jsmpeg

MPEG1 Video Decoder in JavaScript
MIT License
6.3k stars 1.43k forks source link

websocket connect with different backend server #400

Closed joyhope closed 1 year ago

joyhope commented 2 years ago

`

` The websocket without options. But the websocket request will have Sec-WebSocket-Protocol: null

For some kind of websocket server: python, golang, etc, I guess the null will send back, which caused chrome refused to make WebSocket connection.

Just make small change if (this.options.protocols != null) { this.socket = new WebSocket(this.url, this.options.protocols); } else { this.socket = new WebSocket(this.url); }

So the null information will go away, it is much easy to use.

The relay using websocket-relay.js won't meet the problem, but using other relay will meet the problem in Chrome browser. But won't meet problem in firefox.

joyhope commented 2 years ago

The similar problem:

https://github.com/defold/extension-websocket/releases/tag/1.5.1

MaxRev-Dev commented 1 year ago

+1 on this. I'm trying to run relay from armv7 Raspbian, but can't compile websocket-relay to an executable for armv7 (I've tried nexe, pkg). So I decided to write my own relay backend and the connection fails to be established.

phoboslab commented 1 year ago

Should be fixed with https://github.com/phoboslab/jsmpeg/commit/3afb0e5df2ef0cc21512d956011b83325978686a