mirror of
https://github.com/actix/actix-extras.git
synced 2025-06-25 18:09:22 +02:00
upgrade to actix 0.4
This commit is contained in:
@ -195,13 +195,8 @@ fn main() {
|
||||
}
|
||||
```
|
||||
|
||||
It is possible to use unix signals on compatible OSs. "signal" feature needs to be enabled
|
||||
in *Cargo.toml* for *actix-web* dependency.
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
actix-web = { git = "https://github.com/actix/actix-web", features=["signal"] }
|
||||
```
|
||||
It is possible to use signals. *CTRL-C* is available on all OSs, other signals are
|
||||
available on unix systems.
|
||||
|
||||
Then you can subscribe your server to unix signals. Http server handles three signals:
|
||||
|
||||
|
@ -23,15 +23,15 @@ impl Actor for Ws {
|
||||
/// Define Handler for ws::Message message
|
||||
# impl StreamHandler<ws::Message> for Ws {}
|
||||
impl Handler<ws::Message> for Ws {
|
||||
fn handle(&mut self, msg: ws::Message, ctx: &mut HttpContext<Self>) -> Response<Self, ws::Message>
|
||||
{
|
||||
type Result=();
|
||||
|
||||
fn handle(&mut self, msg: ws::Message, ctx: &mut HttpContext<Self>) {
|
||||
match msg {
|
||||
ws::Message::Ping(msg) => ws::WsWriter::pong(ctx, &msg),
|
||||
ws::Message::Text(text) => ws::WsWriter::text(ctx, &text),
|
||||
ws::Message::Binary(bin) => ws::WsWriter::binary(ctx, bin),
|
||||
_ => (),
|
||||
}
|
||||
Self::empty()
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user