My site connects to a real-time data stream using web sockets. A data stream is just a series of JSON messages. In websocket handlers, when I get a message, I parse JSON and add some data points to the chart.
My question is: does it make sense to move the websocket to my own workflow?
At first I thought I could parse JSON in my thread and send the UI thread to a deserialized object, which could save some time. Unfortunately, postMessage seems to require me to send strings. Therefore, there is no use in parsing JSON in its thread.
It also doesn’t seem that there will be any benefit in receiving web socket data in its own stream - I would conclude that the browser is already receiving data from the wires in its stream and passes my javascript callback at the appropriate time.
So, given the fact that there is no further processing when receiving real-time data, this is mainly straight to the user interface. Does it make sense to connect to a website as a web user?
Thanks! Andrew
source share