1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 18:09:22 +02:00

update example to use actix 0.4

This commit is contained in:
Nikolay Kim
2018-01-05 14:01:19 -08:00
parent 5ff35f5b99
commit 5ae646332e
15 changed files with 150 additions and 243 deletions

View File

@ -11,7 +11,6 @@ use std::cell::Cell;
use actix::*;
use actix_web::*;
#[cfg(unix)]
use actix::actors::signal::{ProcessSignals, Subscribe};
/// Application state
@ -40,9 +39,9 @@ impl Actor for MyWebSocket {
impl StreamHandler<ws::Message> for MyWebSocket {}
impl Handler<ws::Message> for MyWebSocket {
fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context)
-> Response<Self, ws::Message>
{
type Result = ();
fn handle(&mut self, msg: ws::Message, ctx: &mut Self::Context) {
self.counter += 1;
println!("WS({}): {:?}", self.counter, msg);
match msg {
@ -54,7 +53,6 @@ impl Handler<ws::Message> for MyWebSocket {
}
_ => (),
}
Self::empty()
}
}
@ -77,11 +75,8 @@ fn main() {
.start();
// Subscribe to unix signals
#[cfg(unix)]
{
let signals = actix::Arbiter::system_registry().get::<ProcessSignals>();
signals.send(Subscribe(addr.subscriber()));
}
let signals = actix::Arbiter::system_registry().get::<ProcessSignals>();
signals.send(Subscribe(addr.subscriber()));
println!("Started http server: 127.0.0.1:8080");
let _ = sys.run();