Replies: 1 comment
-
You can't send buffer/binary inside JSON string unless you convert to string format with base64, it will use 33% more space, then decode base64 on client. Better send buffer data as separate message in binary format |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm having some small tachometer (esm) files (20-30 kb) and would like to send them through to client using
ws.send
but together with some other data (json).I've succeeded reading the file as base64 and sending it as part of the json object, but would like to send it as arraybuffer as that is what i need on the client, is this possible :
or something like that...
With this code I'm getting invalid array buffer on the client, it's like it's Uint8Array having the value of the array buffer or something like that :) I don't have much experience with buffers..
I'm getting
Uint8Array(133175)} and buffer: ArrayBuffer(133209)
and it should be ArrayBuffer(133175)
so the ArrayBuffer from nodejs gets to be Uint8Array on browser ...
Any help with this?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions