bittere
bittere5mo ago

Server isolates cause Socket.IO problems

Hi guys, I have a simple socket.IO program that basically broadcasts the changes in any one client's input field to every other client's input field. But I've seen that since Deno Deploy runs the different servers on the edge, different socket.IO servers are run for users from different locations. This means that eg. someone sitting in Asia and making a change won't affect the input of someone sitting in Europe. I believe a solution to this would be to use Deno KV or some other database to store the changes globally, but that would introduce delays that defeat the whole purpose of realtime communication. What other solutions would you recommend? Is there any configuration on Deno Deploy or socket.IO that fixes this? Thanks!
1 Reply
fro.profesional
fro.profesional5mo ago
BroadcastChannel doesn’t always work, is better to use deno kv watch If u want to connect people from Asia and Europe u would need a central server which requires longer trip or central state which also add latency your choice