Question

I write node.js application with websockets based on sockjs and I need to make minimal update time on client.

Events in application occur every Nms (e.g. 20ms) and I need make broadcast changes to users as fast as I can.

Every update is 100-200 bytes. Ping to sever is 90-200ms.

If I send message every time event happened - there is some lags on client app and.. It's bad idea by design.

If I send message every Nms (e.g 200ms) - updates on client looks more smooth, but there is too many "frame drops"

Is this good idea to mix this methods and send

Maybe I need to make "no-necessarily" updates which will overwrite if "second" update will come earlier than "first", because ping.. And how to "drop frame" if there is heap of updates on client.

What's the best way to broadcast updates to user? Thanks.

Was it helpful?

Solution 2

Only one thing I can recommend, it's look at the source code of meteor.js They use latency compensation and SockJS.

OTHER TIPS

Okay, there is only one solution for compensation latency lags - predict events between two data packets.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top