yjs / y-websocket

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

cannot connect to y-websocket with node #172

Closed scenaristeur closed 7 months ago

scenaristeur commented 9 months ago

hosted y-websocket server on https://glitch.com/edit/#!/ylm-websocket (wait 30 seconds, for the server to start)

is ok

image

i can connect with browser y-websocket but not with node (it loop in 'connecting' status) version using (don't forget to put "type":"module", in package.json to use es6 as mentionned in https://github.com/yjs/y-websocket/issues/170

but i can connect to 127.0.0.1:1234 too with node is there something needing for firewall or something ?


import * as Y from "yjs";
import * as W from "y-websocket";
import WebSocket from "ws";

const doc = new Y.Doc()

const wsProvider = new W.WebsocketProvider(
    "wss://ylm-websocket.glitch.me",
    'my-roomname',
     doc,
    { WebSocketPolyfill: WebSocket }
  );
wsProvider.on('status', event => {
  console.log(event.status) 
})
scenaristeur commented 7 months ago

closed by https://github.com/yjs/y-websocket/pull/173#issuecomment-1962889278