pub fn listen<A, F, H>(addr: A, factory: F) -> Result<()> where
    A: ToSocketAddrs + Debug,
    F: FnMut(Sender) -> H,
    H: Handler
Expand description

A utility function for setting up a WebSocket server.

Safety

This function blocks until the event loop finishes running. Avoid calling this method within another WebSocket handler.

Examples

use parity_ws::listen;

listen("127.0.0.1:3012", |out| {
    move |msg| {
       out.send(msg)
   }
}).unwrap()