mirror of
https://github.com/actix/actix-web.git
synced 2024-12-30 03:50:42 +00:00
update examples
This commit is contained in:
parent
71da72efdb
commit
896981cdf8
5 changed files with 11 additions and 6 deletions
|
@ -25,5 +25,6 @@ serde = "1.0"
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
|
|
||||||
actix = "0.4"
|
#actix = "0.4"
|
||||||
|
actix = { git = "https://github.com/actix/actix" }
|
||||||
actix-web = { git = "https://github.com/actix/actix-web" }
|
actix-web = { git = "https://github.com/actix/actix-web" }
|
||||||
|
|
|
@ -67,11 +67,13 @@ impl Actor for ChatClient {
|
||||||
self.hb(ctx)
|
self.hb(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stopping(&mut self, _: &mut FramedContext<Self>) {
|
fn stopping(&mut self, _: &mut FramedContext<Self>) -> bool {
|
||||||
println!("Disconnected");
|
println!("Disconnected");
|
||||||
|
|
||||||
// Stop application on disconnect
|
// Stop application on disconnect
|
||||||
Arbiter::system().send(actix::msgs::SystemExit(0));
|
Arbiter::system().send(actix::msgs::SystemExit(0));
|
||||||
|
|
||||||
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,9 +75,10 @@ impl Actor for WsChatSession {
|
||||||
}).wait(ctx);
|
}).wait(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stopping(&mut self, ctx: &mut Self::Context) {
|
fn stopping(&mut self, ctx: &mut Self::Context) -> bool {
|
||||||
// notify chat server
|
// notify chat server
|
||||||
ctx.state().addr.send(server::Disconnect{id: self.id});
|
ctx.state().addr.send(server::Disconnect{id: self.id});
|
||||||
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,10 +52,10 @@ impl Actor for ChatSession {
|
||||||
}).wait(ctx);
|
}).wait(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stopping(&mut self, ctx: &mut Self::Context) {
|
fn stopping(&mut self, ctx: &mut Self::Context) -> bool {
|
||||||
// notify chat server
|
// notify chat server
|
||||||
self.addr.send(server::Disconnect{id: self.id});
|
self.addr.send(server::Disconnect{id: self.id});
|
||||||
ctx.stop()
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,5 +10,6 @@ path = "src/main.rs"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
env_logger = "*"
|
env_logger = "*"
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
actix = "0.4"
|
#actix = "0.4"
|
||||||
|
actix = { git = "https://github.com/actix/actix.git" }
|
||||||
actix-web = { git = "https://github.com/actix/actix-web.git" }
|
actix-web = { git = "https://github.com/actix/actix-web.git" }
|
||||||
|
|
Loading…
Reference in a new issue