Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebTransport Feature #938

Open
andodeki opened this issue Feb 11, 2024 · 1 comment
Open

WebTransport Feature #938

andodeki opened this issue Feb 11, 2024 · 1 comment

Comments

@andodeki
Copy link

How is the Web Transport support with xitca?

@fakeshadow
Copy link
Collaborator

it's already supported. you can use xitca's http library to handle webtransport just fine like this example:

use quinn::ServerConfig;
use xitca_io::net::UdpStream;
use xitca_service::fn_service;

fn main() -> std::io::Result<()> {
    xitca_server::Builder::new()
        .bind_h3("wt", "localhost:8080", h3_config(), fn_service(handler)?
        .build()
        .wait()
}

async fn handler(stream: UdpStream) -> io::Result<()> {
    let conn = stream.connecting().await?;
    // do whatever with h3 connection.
    Ok(())
}

fn h3_config() -> ServerConfig {
    todo!("your quinn config goes here")
}

There is no plan to support it inside xitca-web yet. The webtransport API is too alien to a web framework and in most time you end up with hijacking the connection and dealing with ugly low level code anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants