Friday 29 April 2016

(websockets) is there a faster way to send objects than calling JSON.stringify and JSON.parse?

I'm building something that's extensively depending on the ws package in nodejs for web sockets. I wrote a small method called emit which just takes an object you pass to it, calls JSON.stringify on the object to convert it to a string, then sends it to the client. The client retrieves the string and calls JSON.parse to convert it back to an object.The problem I'm facing is that I have to send thousands and thousands of packets, and I want my webpage to work decently well on my cell phone and other under powered machines, so I was wondering if there's a more efficient way of sending a js object/array other than hitting up stringify and parse for every message.

Submitted April 29, 2016 at 08:24PM by dont_forget_canada

No comments:

Post a Comment