I want to deploy this web socket server, called y-websocket.
Normally I would start it locally via
HOST=localhost PORT=1234 npx y-websocket
but how would I do it here? Also how do I make it sure, that only my frontend, deployed to pages can connect to it?
You’re not going to be able run something like
y-websocket directly with Workers as it uses a lot of Node libraries.
Workers do support WebSockets though, see the following docs:
@cherryjimbo Many thanks for getting back to me.
So when I start with this,
https://github.com/yjs/y-websocket, and I want to connect my frontend, hosted at pages, to it, how would I do it. I am still struggling how to set things up correctly, from a workers side.
@cherryjimbo Many thanks again for your input. Do you have some concrete manual/code fragments or so to make this websocket run in worker?
I do not, sorry. What have you tried? What errors have you run into? I would recommend consulting the docs for
y-websocket, but I doubt you’re going to be able to have it run within a Worker directly, and will need to rebuild your code around the WebSocket support in Workers, with the documentation I previously linked: