pub fn encode_inbound_payload(bytes: &[u8]) -> (String, &'static str)Expand description
Turn received binary-frame bytes into the (data, encoding) pair the model sees.
Printable ASCII is passed through as text so the model can read it; anything else is
base64. The pair is exactly what send_websocket_binary consumes, so echoing a frame is
{"type": "send_websocket_binary", "data": event.data, "encoding": event.encoding} and the
bytes on the wire are identical. Getting this asymmetric is the send_tcp_data bug
(d70bb5b5), where inbound was encoded and outbound was not and an echo server could not
echo.