By default, socket.io will call
stringify for you so it's pointless to do it manually.
Most likely, simple
socket.emit('message', obj) does what you want. Even if you want to emit binary, that's how it done. It seems it "just works", there is not much documentation about it. Basically, you have to emit something that passes
hasBin-check ie. it has to be
There is no
Buffer.fromObject-method in Node.js API, for a reason. If you want to send your
Object as binary, you have to design how to represent it as binary data. Whether or not, it's good idea, depends on what kind of data you are dealing with. If your data is mostly strings, then you can't shim it much. If you have a lot of integers, numbers, booleans etc, then using binary might be good idea, but it's quite bit of extra work to design efficient binary format.
Buffer, send using socket.io and then deserialize it in browser. I haven't ever used it in browser environment: it sounds like interesting idea but it would need some performance testing.