QUIC via Direct Sockets in the browser: Need to change port from 0

โš“ Rust    ๐Ÿ“… 2025-10-05    ๐Ÿ‘ค surdeus    ๐Ÿ‘๏ธ 6      

surdeus

A user in the field responded to my inquiry for implementing a WebTransport server in the browser over Direct Sockets with this GitHub - maceip/quinn-wasm at direct-sockets. That's how they got. The rest is on me, I think. The issue right now is the code as-is tries to connect UDPSocket to address "0.0.0.0" and port 0. That port 0 doesn't work with UDPSocket. I'm getting this message followed by this error


quinn_wasm_direct_sockets.js:333 INFO examples/direct-sockets-web/src/lib.rs:19 "Hello from Direct Sockets!"
Connecting to QUIC using Direct Sockets! quic_host = "127.0.0.1:4000";
quinn_wasm_direct_sockets.js:395 
{localAddress: '0.0.0.0', localPort: 0}
(index):193 Connection failed: Failed to convert to UDPSocketStreams: JsValue(Object({"localAddress":"0.0.0.0","localPort":4000,"readable":{},"writable":{}}))
(anonymous)	@	(index):193

I'm thinking the issue needs to be corrected somewhere around here quinn-wasm/examples/direct-sockets-web/src/lib.rs at direct-sockets ยท maceip/quinn-wasm ยท GitHub

#[wasm_bindgen]
pub async fn connect_quic_direct_sockets(
    quic_host: &str,
    message: &str,
) -> Result<String, AppError> {
    info!(?quic_host, ?message, "Connecting to QUIC using Direct Sockets!");


    let remote_addr: SocketAddr = quic_host.parse()?;
    let local_addr: SocketAddr = "0.0.0.0:0".parse()?;
    let client_config = configure_client();


    // Use Direct Sockets instead of WebSocket relay
    let ep = quinn_wasm::direct_sockets::create_direct_socket_endpoint(
        local_addr,
        None,
        Some(client_config),
    )
    .await?;


    info!("Direct Socket endpoint created!");

because I never get that "Direct Socket endpoint created!" message. Where and how do I hardcode the port?

3 posts - 1 participant

Read full topic

๐Ÿท๏ธ Rust_feed