Struct ws::WebSocket [] [src]

pub struct WebSocket<F> where F: Factory {
    // some fields omitted
}

The WebSocket struct. A WebSocket can support multiple incoming and outgoing connections.

Methods

impl<F> WebSocket<F> where F: Factory
[src]

fn new(factory: F) -> Result<WebSocket<F>>

Create a new WebSocket using the given Factory to create handlers.

fn with_config(factory: F, config: EventLoopConfig) -> Result<WebSocket<F>>

Create a new WebSocket with a Factory and use the event loop config to provide settings for the event loop.

fn listen<A>(self, addr_spec: A) -> Result<WebSocket<F>> where A: ToSocketAddrs + Debug

Consume the WebSocket and listen for new connections on the specified address.

Safety

This method will block until the event loop finishes running.

fn connect(&mut self, url: Url) -> Result<&mut WebSocket<F>>

Queue an outgoing connection on this WebSocket. This method may be called multiple times, but the actuall connections will not be established until after run is called.

fn run(self) -> Result<WebSocket<F>>

Run the WebSocket. This will run the encapsulated event loop blocking until the WebSocket is shutdown.