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