Sending STDIN to an interactive websocket

I am able to start running a command, and recieve STDOUT and STDERR via the websocket opened (In interactive mode and wait for websocket), but when i try to sending a message to STDIN via the websocket (Using websocket.Send(“input”)), the server simply echos it back at me instead of feeding it to the program. Is there a special format or syntax i should be using? The command running is “apt install nginx” and i am trying to send the string “Y”.

Update: Sending as bytes (both utf8 and ascii) trigger echo, whereas sending it as a normal websocket message result in no effect (No echo, but program also doesnt get the input)

1 Like

Solved, you need to send the data as UTF8 bytes, and terminate the string in \r

byte[] b = Encoding.UTF8.GetBytes("y \r");
ws.Send(b, 0, b.Length);