mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-24 08:22:59 +01:00
fix example
This commit is contained in:
parent
73ed1342eb
commit
728377a447
@ -64,7 +64,7 @@ impl Actor for WsChatSession {
|
||||
// routes within application
|
||||
let addr: SyncAddress<_> = ctx.address();
|
||||
ctx.state().addr.call(
|
||||
self, server::Connect{addr: addr.into_subscriber()}).then(
|
||||
self, server::Connect{addr: addr.into()}).then(
|
||||
|res, act, ctx| {
|
||||
match res {
|
||||
Ok(Ok(res)) => act.id = res,
|
||||
|
@ -13,7 +13,7 @@ use session;
|
||||
|
||||
/// New chat session is created
|
||||
pub struct Connect {
|
||||
pub addr: Box<actix::Subscriber<session::Message> + Send>,
|
||||
pub addr: SyncSubscriber<session::Message>,
|
||||
}
|
||||
|
||||
/// Response type for Connect message
|
||||
@ -61,7 +61,7 @@ pub struct Join {
|
||||
/// `ChatServer` manages chat rooms and responsible for coordinating chat session.
|
||||
/// implementation is super primitive
|
||||
pub struct ChatServer {
|
||||
sessions: HashMap<usize, Box<actix::Subscriber<session::Message> + Send>>,
|
||||
sessions: HashMap<usize, SyncSubscriber<session::Message>>,
|
||||
rooms: HashMap<String, HashSet<usize>>,
|
||||
rng: RefCell<ThreadRng>,
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ impl Actor for ChatSession {
|
||||
// future within context, but context waits until this future resolves
|
||||
// before processing any other events.
|
||||
let addr: SyncAddress<_> = ctx.address();
|
||||
self.addr.call(self, server::Connect{addr: addr.into_subscriber()})
|
||||
self.addr.call(self, server::Connect{addr: addr.into()})
|
||||
.then(|res, act, ctx| {
|
||||
match res {
|
||||
Ok(Ok(res)) => act.id = res,
|
||||
|
Loading…
Reference in New Issue
Block a user