Closed InfiniteCoder01 closed 11 months ago
Tested on Google Chrome and Microsoft Edge. On firefox works fine
Here are some logs:
14:22:48 [TRACE] (1) hyper::upgrade: [/home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-0.14.27/src/upgrade.rs:236] pending upgrade fulfill
14:22:48 [TRACE] (1) warp::filters::ws: [/home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/warp-0.3.6/src/filters/ws.rs:153] websocket upgrade complete
14:22:48 [TRACE] (1) tokio_tungstenite::handshake: [/home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/handshake.rs:50] Setting context when skipping handshake
14:22:48 [TRACE] (1) tokio_tungstenite: [/home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/lib.rs:288] /home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/lib.rs:288 Stream.poll_next
14:22:48 [TRACE] (1) tokio_tungstenite: [/home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/lib.rs:243] /home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/lib.rs:243 WebSocketStream.with_context
14:22:48 [TRACE] (1) tokio_tungstenite: [/home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/lib.rs:298] /home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/lib.rs:298 Stream.with_context poll_next -> read()
14:22:48 [TRACE] (1) tokio_tungstenite::compat: [/home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/compat.rs:149] /home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/compat.rs:149 Read.read
14:22:48 [TRACE] (1) tokio_tungstenite::compat: [/home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/compat.rs:126] /home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/compat.rs:126 AllowStd.with_context
14:22:48 [TRACE] (1) tokio_tungstenite::compat: [/home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/compat.rs:152] /home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/compat.rs:152 Read.with_context read -> poll_read
14:22:48 [TRACE] (1) tungstenite::protocol::frame: [/home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tungstenite-0.20.1/src/protocol/frame/mod.rs:192] no frame received
14:22:48 [DEBUG] (1) warp::filters::ws: websocket poll error: WebSocket protocol error: Connection reset without closing handshake
14:22:48 [TRACE] (1) tokio_tungstenite: [/home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/lib.rs:243] /home/infinitecoder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-tungstenite-0.20.1/src/lib.rs:243 WebSocketStream.with_context
14:22:48 [DEBUG] (1) tokio_tungstenite: websocket start_send error: Trying to work with closed connection
14:22:48 [DEBUG] (1) warp::filters::ws: websocket start_send error: Trying to work with closed connection
14:22:54 [ERROR] Element autovideosink0-actual-sink-xvimage: Output window was closed
14:22:54 [ERROR] Element videotestsrc0: Internal data stream error.
From my experiments, It does actually call on_upgrade, but the connection closes immediately
Eventually, I've figured it out. Since warp doesn't send Sec-WebSocket-Protocol header, I shouldn't have set protocol, second parameter to WebSocket constructor.
Version 0.3.6
Platform The output of
uname -a
(UNIX), or version and 32 or 64-bit (Windows) Linux InfiniteCodersWorkhorse 6.6.6-arch1-1 #1 SMP PREEMPT_DYNAMIC Mon, 11 Dec 2023 11:48:23 +0000 x86_64 GNU/LinuxDescription I'm facing this exact issue: https://stackoverflow.com/questions/71342595/chrome-websocket-connection-closes-immediately