Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Best way to speedup websockets

Best way to speedup websockets


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 owerwrite 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.

Problem courtesy of: Shara


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

Solution courtesy of: NiLL


View additional discussion.

This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

Best way to speedup websockets


Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription