Closed solarkraft closed 1 year ago
You may want to use --binary
on server side (websocat --binary -s 1234
) as well to have bit-transparent connection.
In text mode Websocat tries to ensure that one Websocket message = one line (\n
-delimited).
You're right, that solves it, thank you!
So I'm still trying to use websocat on macOS to connect to a MicroPython WebREPL. The MicroPython WebREPL requires windows-style newlines, meaning a line feed (\n) and a carriage return (\r).
But when sending a carriage return into websocat, a line feed gets sent to the other side instead.
First we can confirm that our terminal really does send the correct newline type to programs:
stty raw; xxd -ps
When typing enter the characters 0d should appear, which is ASCII character 13, a.k.a. carriage return. We can also type ^M and ^J, resulting in 0d and 0a.Let's look at a similar setup using websocat:
Shell 1:
websocat -s 1234 | xxd -ps
Shell 2:
stty raw; websocat --binary ws://127.0.0.1:1234/
When typing enter, ^M or ^J into shell 2 (many times for the xxd buffer to fill up), 0a (ASCII character 10 a.k.a. line feed or \n) always appears in shell 1 It is not possible to send a carriage return.
Please forgive me if my setup is flawed, I've only started learning about control characters, escape sequences and terminal modes yesterday. This is the furthest I can trace the problem so far.