Skip to content

Binary Websocket sends data as text instead of binary #4625

Answered by jerch
Ne00n asked this question in Q&A
Discussion options

You must be logged in to vote

Yes client --> server way always sends text input as text (everything from term.onData event). This is needed to distingish text input from binary data as sent by term.onBinary.
If you want both to be sent with binary transport, you'd have to implement a protocol, that still makes it possible to separate both event types, if you want to able to utf-8 encode the text parts on server side. If you dont care for utf-8 encoding on server side, you can simply send both event types as Uint8Array (thus always getting bytes, but ofc lose the ability to safely convert text back into unicode).

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Tyriar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #4555 on July 31, 2023 13:31.