finchers-tungstenite

WebSocket support for Finchers, based on tungstenite

1 unstable release

0.1.0 Oct 2, 2018

#39 in WebSocket

Download history 7/week @ 2018-10-03

2 downloads per month

MIT/Apache

10KB
189 lines

finchers-tungstenite

crates.io Docs.rs dependency status Build Status Coverage Status

WebSocket support for Finchers based on tungstenite.

License

MIT license or Apache License, Version 2.0 at your option.


lib.rs:

WebSocket support for Finchers based on tungstenite.

Example

#[macro_use]
extern crate finchers;
extern crate finchers_tungstenite;
# extern crate futures;

use finchers::prelude::*;
use finchers_tungstenite::{
  Ws,
  WsTransport,
};

# fn main() {
let endpoint = path!(@get / "ws" /)
    .and(finchers_tungstenite::ws())
    .map(|ws: Ws| {
        ws.on_upgrade(|ws: WsTransport| {
            // ...
#           drop(ws);
#           futures::future::ok(())
        })
    });
# drop(|| {
# finchers::server::start(endpoint)
#     .serve("127.0.0.1:4000")
#     .unwrap();
# });
# }

Dependencies

~14MB
~309K SLoC