Replies: 4 comments 1 reply
-
It won't be easy to make this an official feature of socket.io. To build and run it in CF worker it required quite a few tweaks in If a reusable artifact interests other people I guess the easier way is to create a custom |
Beta Was this translation helpful? Give feedback.
-
@jokester I guess what we could do is create an engine based on the Cloudflare WebSocket server, and then bind it to the high-level Socket.IO server. The engine manages the low-level connections (HTTP long-polling or WebSocket). The |
Beta Was this translation helpful? Give feedback.
-
Months later: I think I have a working version now: https://github.com/jokester/socket.io-serverless . It is based on engine.io (WebSocketTransport) and socket.io (Server / Client / Socket / Namespace / Adapter) code, but rewires a lot to work in Cloudflare Worker , especially to support hibernation / alarm. I learned a lot making this lol. |
Beta Was this translation helpful? Give feedback.
-
Check out https://www.partykit.io/. It's a WebSocket server built on top of CF/DurableObjects with a TypeScript SDK. |
Beta Was this translation helpful? Give feedback.
-
I am interested by serverless websocket server and cost saving (via WebSocket Hibernation) CF provide, so I made a PoC / code.
Many pieces are lacking including persisted state, WS Hibernation, clustering or load balancing but it basically works.
I don't have a clear roadmap though, so ideas welcome 🤔
======
Update: a working npm package at https://github.com/jokester/socket.io-serverless / https://www.npmjs.com/package/socket.io-serverless .
Beta Was this translation helpful? Give feedback.
All reactions