pub struct WsProxy { /* private fields */ }Expand description
WebSocket reverse proxy with round-robin load balancing.
Accepts plain HTTP/1.1 WebSocket upgrade requests, tunnels the handshake to a backend, and relays all subsequent frames bidirectionally.
For TLS-terminated WebSocket proxying, place a TLS terminator in front (e.g. another rws instance with TLS configured) and point it at this proxy.
Call WsProxy::bind to start. It blocks the calling thread indefinitely.
Implementations§
Source§impl WsProxy
impl WsProxy
Sourcepub fn new<I, S>(backends: I) -> Self
pub fn new<I, S>(backends: I) -> Self
Create a proxy that distributes connections across backends in
round-robin order. Each entry must be "host:port".
Sourcepub fn connect_timeout_ms(self, ms: u64) -> Self
pub fn connect_timeout_ms(self, ms: u64) -> Self
Override the TCP connect timeout to each backend (default: 5 s).
Sourcepub fn read_timeout_ms(self, ms: u64) -> Self
pub fn read_timeout_ms(self, ms: u64) -> Self
Override the idle read timeout on client connections (default: 30 s).
Auto Trait Implementations§
impl Freeze for WsProxy
impl RefUnwindSafe for WsProxy
impl Send for WsProxy
impl Sync for WsProxy
impl Unpin for WsProxy
impl UnsafeUnpin for WsProxy
impl UnwindSafe for WsProxy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more