Struct sockjs::SockJSContext
[−]
[src]
pub struct SockJSContext<A> where
A: Session,
A::Context: AsyncContext<A>, { /* fields omitted */ }
Sockjs session context
Methods
impl<A> SockJSContext<A> where
A: Session<Context = Self>,
[src]
A: Session<Context = Self>,
pub fn sid(&self) -> &Arc<String>
[src]
Session id
pub fn send<M>(&mut self, message: M) where
M: Into<Message>,
[src]
M: Into<Message>,
Send message to peer
pub fn broadcast<M>(&mut self, message: M) where
M: Into<Message>,
[src]
M: Into<Message>,
Send message to all sessions
pub fn close(&mut self)
[src]
Close session
pub fn connected(&mut self) -> bool
[src]
Check if transport is connected
Trait Implementations
impl<A> ActorContext for SockJSContext<A> where
A: Session<Context = Self>,
[src]
A: Session<Context = Self>,
fn stop(&mut self)
[src]
Stop actor execution
fn terminate(&mut self)
[src]
Terminate actor execution
fn state(&self) -> ActorState
[src]
Actor execution state
impl<A> AsyncContext<A> for SockJSContext<A> where
A: Session<Context = Self>,
[src]
A: Session<Context = Self>,
fn spawn<F>(&mut self, fut: F) -> SpawnHandle where
F: ActorFuture<Item = (), Error = (), Actor = A> + 'static,
[src]
F: ActorFuture<Item = (), Error = (), Actor = A> + 'static,
Spawn async future into context. Returns handle of the item, could be used for cancelling execution. Read more
fn wait<F>(&mut self, fut: F) where
F: ActorFuture<Item = (), Error = (), Actor = A> + 'static,
[src]
F: ActorFuture<Item = (), Error = (), Actor = A> + 'static,
Spawn future into the context. Stop processing any of incoming events until this future resolves. Read more
fn cancel_future(&mut self, handle: SpawnHandle) -> bool
[src]
Cancel future. idx is a value returned by spawn
method.
fn unsync_address(&mut self) -> Addr<Unsync, A>
[src]
fn sync_address(&mut self) -> Addr<Syn, A>
[src]
fn address<Address>(&mut self) -> Address where
A: ActorAddress<A, Address>,
[src]
A: ActorAddress<A, Address>,
Get actor address
fn waiting(&self) -> bool
[src]
Check if context is paused (waiting for future completion or stopping)
fn add_stream<S>(&mut self, fut: S) -> SpawnHandle where
A: StreamHandler<<S as Stream>::Item, <S as Stream>::Error>,
S: Stream + 'static,
[src]
A: StreamHandler<<S as Stream>::Item, <S as Stream>::Error>,
S: Stream + 'static,
This method register stream to an actor context and allows to handle Stream
in similar way as normal actor messages. Read more
fn add_message_stream<S>(&mut self, fut: S) where
A: Handler<<S as Stream>::Item>,
S: Stream<Error = ()> + 'static,
<S as Stream>::Item: Message,
[src]
A: Handler<<S as Stream>::Item>,
S: Stream<Error = ()> + 'static,
<S as Stream>::Item: Message,
This method is similar to add_stream
but it skips stream errors. Read more
fn notify<M>(&mut self, msg: M) where
A: Handler<M>,
M: Message + 'static,
[src]
A: Handler<M>,
M: Message + 'static,
Send message msg
to self.
fn notify_later<M>(&mut self, msg: M, after: Duration) -> SpawnHandle where
A: Handler<M>,
M: Message + 'static,
[src]
A: Handler<M>,
M: Message + 'static,
Send message msg
to self after specified period of time. Returns spawn handle which could be used for cancellation. Notification get cancelled if context's stop method get called. Read more
fn run_later<F>(&mut self, dur: Duration, f: F) -> SpawnHandle where
F: FnOnce(&mut A, &mut <A as Actor>::Context) + 'static,
[src]
F: FnOnce(&mut A, &mut <A as Actor>::Context) + 'static,
Execute closure after specified period of time within same Actor and Context. Execution get cancelled if context's stop method get called. Read more
impl<A, M> ToEnvelope<Syn, A, M> for SockJSContext<A> where
A: Session<Context = SockJSContext<A>> + Handler<M>,
M: ActixMessage + Send + 'static,
M::Result: Send,
[src]
A: Session<Context = SockJSContext<A>> + Handler<M>,
M: ActixMessage + Send + 'static,
M::Result: Send,