berkant
CDCloudflare Developers
•Created by Blue on 2/2/2024 in #workers-help
Trouble hosting websocket server
What I'm saying is, what you want is indeed doable but not without Durable Objects.
28 replies
CDCloudflare Developers
•Created by Blue on 2/2/2024 in #workers-help
Trouble hosting websocket server
Not other clients.
28 replies
CDCloudflare Developers
•Created by Blue on 2/2/2024 in #workers-help
Trouble hosting websocket server
That only guides you on how to set up a server and exchange messages with the connecting client itself.
28 replies
CDCloudflare Developers
•Created by Blue on 2/2/2024 in #workers-help
Trouble hosting websocket server
I think you should get an understanding of how Workers work.
28 replies
CDCloudflare Developers
•Created by Blue on 2/2/2024 in #workers-help
Trouble hosting websocket server
Source?
28 replies
CDCloudflare Developers
•Created by Blue on 2/2/2024 in #workers-help
Trouble hosting websocket server
You are expected to rewrite parts of your code to accommodate to a serverless runtime like Workers.
28 replies
CDCloudflare Developers
•Created by Blue on 2/2/2024 in #workers-help
Trouble hosting websocket server
28 replies
CDCloudflare Developers
•Created by Blue on 2/2/2024 in #workers-help
Trouble hosting websocket server
Durable Objects it is.
28 replies
CDCloudflare Developers
•Created by Blue on 2/2/2024 in #workers-help
Trouble hosting websocket server
But the runtime itself could have thousands of isolates with each having a different internal state and execution context, which means making changes to connections variable isn't going to propagate to other connections.
28 replies
CDCloudflare Developers
•Created by Blue on 2/2/2024 in #workers-help
Trouble hosting websocket server
Having a top level variable is syntactically correct and allowed.
28 replies
CDCloudflare Developers
•Created by Blue on 2/2/2024 in #workers-help
Trouble hosting websocket server
You should treat your Workers code more like shared-nothing just as how PHP does it.
28 replies
CDCloudflare Developers
•Created by Blue on 2/2/2024 in #workers-help
Trouble hosting websocket server
Well, you should probably look into Durable Objects at this point because having a global list of connections as it is right now wouldn't really help as far as Workers runtime is concerned.
28 replies