mirror of
https://github.com/actix/examples
synced 2024-11-27 16:02:57 +01:00
Fix client. (#400)
This commit is contained in:
parent
91865b3a2a
commit
c36d7371a9
@ -74,7 +74,7 @@ impl Actor for ChatClient {
|
|||||||
impl ChatClient {
|
impl ChatClient {
|
||||||
fn hb(&self, ctx: &mut Context<Self>) {
|
fn hb(&self, ctx: &mut Context<Self>) {
|
||||||
ctx.run_later(Duration::new(1, 0), |act, ctx| {
|
ctx.run_later(Duration::new(1, 0), |act, ctx| {
|
||||||
act.0.write(Message::Ping(Bytes::from_static(b""))).unwrap();
|
act.0.write(Message::Ping(Bytes::from_static(b"")));
|
||||||
act.hb(ctx);
|
act.hb(ctx);
|
||||||
|
|
||||||
// client should also check for a timeout here, similar to the
|
// client should also check for a timeout here, similar to the
|
||||||
@ -88,7 +88,7 @@ impl Handler<ClientCommand> for ChatClient {
|
|||||||
type Result = ();
|
type Result = ();
|
||||||
|
|
||||||
fn handle(&mut self, msg: ClientCommand, _ctx: &mut Context<Self>) {
|
fn handle(&mut self, msg: ClientCommand, _ctx: &mut Context<Self>) {
|
||||||
self.0.write(Message::Text(msg.0)).unwrap();
|
self.0.write(Message::Text(msg.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user