yjs / y-websocket

Websocket Connector for Yjs
https://docs.yjs.dev/ecosystem/connection-provider/y-websocket
MIT License
523 stars 261 forks source link

WebSocket provider allows redirect #125

Closed davidbrochart closed 2 years ago

davidbrochart commented 2 years ago

Hi @dmonad, It looks like if a WebSocket endpoint returns a redirect to another WebSocket endpoint, the WebSocket provider doesn't follow the redirect. Is that correct? If so, would it be possible to allow redirects?

dmonad commented 2 years ago

The Websocket API in the browser doesn't have such a configuration, I think..

Not sure how one would implement this.

dmonad commented 2 years ago

https://stackoverflow.com/questions/46962881/is-it-possible-to-seamlessly-redirect-websockets

The Q above seams to explain the situation. The browser usually doesn't follow redirects. You could implement a polyfill that supports redirects as explained in the A above.

dmonad commented 2 years ago

FYI: y-websocket accepts a Websocket polyfill.

davidbrochart commented 2 years ago

Interesting, thanks @dmonad !