yjs / y-websocket

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

deploying on glitch and connecting from node #173

Closed scenaristeur closed 6 months ago

scenaristeur commented 6 months ago

user agent could be "WebSocket Client" instead of "firefox"

this adds the ability to connect from nodejs client adding a User-Agent header

resolving https://github.com/yjs/y-websocket/issues/172

https://support.glitch.com/t/unable-to-connect-to-glitch-websocket-server-via-nodejs/62904/4

Huly®: YJS-733

dmonad commented 6 months ago

That is probably a firewall or proxy issue on your side.

WebSockets don't support headers (in the browser), so I don't want to add this feature, as it would be nodejs specific.

If you still want this feature, you could try adding a wrapper around WebSocketPolyfill:

new WebSocketPolyfillPolyfill extends ws.WebSocket {
  constructor(...args) {
    super(...args, { header: '...' })
  }
}