Global websocket latency


Planning on building a collaborative application based on Yjs and trying to decide between WebRTC and Websockets. One thing I am a bit worried about the latency since users are expected to be global. But since I haven’t tried it for real I don’t know if this is a non-issue, hoping some of you have more experience.

Imagine a scenario where two American users are editing a document and the server is located in the EU. How big delays can be expected? Will the awareness feel clunky or is it still instant?


WebRTC is problematic in some countries and for people working for companies that use restrictive firewalls. So unless you are building a videoconferencing solution / or a p2p app, you probably want to use y-websocket in production.

If you want to use y-webrtc in production you should definitely setup a TURN server (which literally acts as a central server forwarding messages). So the benefits are often diminishing, unless most of your users aren’t behind a firewall.

Regarding delays US/EU: You should be fine unless you are building a game. The delay should only be a few hundred milliseconds, almost not noticeable.

Thanks for the great explanation and for relieving my worries Kevin!

Also while I have you here, thanks for all the work you put into Yjs, it’s been very interesting to read about and I’m excited to try it out :grin:

1 Like