Skip to main content

run_ws_loop

Function run_ws_loop 

Source
pub fn run_ws_loop(
    read_stream: &mut dyn Read,
    write_stream: &mut dyn Write,
    on_text: impl FnMut(&str),
) -> Result<()>
Expand description

Handle a WebSocket connection: read frames, respond to control frames, dispatch text messages.

on_text is called for each text frame received. Returns when the connection is closed (by either side).