High latency from server today

I have a game that runs in node.js and uses socket.io. I had never had problems with the latency, but today, the latency has been very high two times in a day. The latency was back to normal several hours ago so I thought it was fixed, but the latency is now back. The problem is for all devices.
I’m not sure whether it is a socket.io problem or a replit problem.
I hope it’ll be fixed soon

Welcome to the community, @farmerdev!

It doesn’t seem to have much latency when I visited your Repls.

You can try visiting other multiplayer Repls like swordbattle.io and see if there
is any high latency.

If the latency still persists, you may want to check your wifi connection.

1 Like

This is the repl that has latency problems: https://rocketer.farmerdev.repl.co/

swordbattle.io doesn’t run on replit afaik (Feel free to correct me if I’m wrong @CoderGautamYT )

It shouldnt be a problem with my WiFi as other people playing the game is also experiencing the high latency
I didn’t change the code when the latency started
Is it something to do with the server resource limits?

It could be. It takes a long time to load the Repl and when loading in a new window. You may want to check how much resources the Repl is using.

ok, i opened the code in a new repl and it seems that it is working fine, i will monitor the repl resources

Haha yeah, swordbattle doesn’t run on Replit, due to issues with Replit similar to what OP is facing.

As a dev who’s used socket.io for a few years now-

It could be a code thing, make sure you aren’t sending too much data over the network, and don’t send stuff too frequently too-- these are all issues that cause lag and latency problems.

It could also be a socket.io thing as the library is slightly bloated, and mainly meant for legacy browser support and isn’t much relevant in current times where almost all commonly used browsers support WebSockets. (would highly recommend using plain WebSockets, much less overhead and lot more control with what you can send (like plain binary))

If you can confirm it’s none of these, try a different host like a DigitalOcean Droplet or Heroku, sometimes Replit isn’t the best place for multiplayer games due to the nature of them using high egress and network.

1 Like