1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-07-01 20:25:09 +02:00

new StreamHandler impl

This commit is contained in:
Nikolay Kim
2018-06-09 07:53:46 -07:00
parent 9151d61eda
commit 818d0bc187
4 changed files with 49 additions and 32 deletions

View File

@ -25,12 +25,12 @@
//!
//! // Handler for ws::Message messages
//! impl StreamHandler<ws::Message, ws::ProtocolError> for Ws {
//! fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) {
//! fn handle(&mut self, msg: Result<Option<ws::Message>, ws::ProtocolError>, ctx: &mut Self::Context) {
//! match msg {
//! ws::Message::Ping(msg) => ctx.pong(&msg),
//! ws::Message::Text(text) => ctx.text(text),
//! ws::Message::Binary(bin) => ctx.binary(bin),
//! _ => (),
//! Ok(Some(ws::Message::Ping(msg))) => ctx.pong(&msg),
//! Ok(Some(ws::Message::Text(text))) => ctx.text(text),
//! Ok(Some(ws::Message::Binary(bin))) => ctx.binary(bin),
//! _ => ctx.stop(),
//! }
//! }
//! }