#proxy #actix #error-message

actix-ws-proxy

A websocket proxy for actix_web

2 releases

0.1.2 Dec 30, 2023
0.1.1 Dec 30, 2023

#229 in WebSocket

MIT license

10KB
193 lines

builds.sr.ht status crates.io Documentation

actix-ws-proxy

A companion to actix-proxy that handles websockets.

Example

use actix_web::{Error, get, HttpRequest, HttpResponse, web};
#[get("/proxy/{port}")]
async fn proxy(
    req: HttpRequest,
    stream: web::Payload,
    port: web::Path<u16>,
) -> Result<HttpResponse, Error> {
    actix_ws_proxy::start(&req, format!("ws://127.0.0.1:{}", port), stream).await
}

Any errors will result in a disconnect on both sides with the error message as the reason.

Dependencies

~19–30MB
~530K SLoC