I am building a javascript socket application which uses socket.io
and I am new to network programming. I don't know what is the best way to pass data in the network. I understand that passing binary data is the most efficient way but it is more complicated. So I want to start with plain objects for now.
I have built a chat application before in which I just used socket.emit('message', obj)
and it works perfectly fine. But I have seen some examples passing the data using socket.emit('message', JSON.stringify(obj))
. I am not sure what the benefit is here. Does it make the data passing on the network smaller size? Is it more efficient than plain object?