denoland / fastwebsockets

A fast RFC6455 WebSocket implementation
https://docs.rs/fastwebsockets/
Apache License 2.0
881 stars 66 forks source link

Split set_auto_ping, set_auto_close issue #87

Open bigvo opened 2 months ago

bigvo commented 2 months ago

Splitted channels require explicitly set set_auto_ping, set_auto_close to false, otherwise frames are being captured without write, which creates wrong frames in reader channel, i.e. instead of OpCode::Ping, reader reads OpCode::Pong on server Ping.

let (mut ws, _) =
        fastwebsockets::handshake::client(&SpawnExecutor, req, tls_stream).await?;
    ws.set_auto_pong(false);
    ws.set_auto_close(false);
    let (rx, tx) = ws.split(tokio::io::split);
    let rx = FragmentCollectorRead::new(rx);
    Ok((rx, tx))