Struct actix_web::ws::WebsocketContext
[−]
[src]
pub struct WebsocketContext<A, S = ()> where
A: Actor<Context = WebsocketContext<A, S>>, { /* fields omitted */ }
Http actor execution context
Methods
impl<A, S: 'static> WebsocketContext<A, S> where
A: Actor<Context = Self>,
[src]
A: Actor<Context = Self>,
fn new(req: HttpRequest<S>, actor: A) -> WebsocketContext<A, S>
[src]
fn from_request(req: HttpRequest<S>) -> WebsocketContext<A, S>
[src]
fn actor(self, actor: A) -> WebsocketContext<A, S>
[src]
impl<A, S> WebsocketContext<A, S> where
A: Actor<Context = Self>,
[src]
A: Actor<Context = Self>,
fn state(&self) -> &S
[src]
Shared application state
fn request(&mut self) -> &mut HttpRequest<S>
[src]
Incoming request
fn text(&mut self, text: &str)
[src]
Send text frame
fn binary<B: Into<Binary>>(&mut self, data: B)
[src]
Send binary frame
fn ping(&mut self, message: &str)
[src]
Send ping frame
fn pong(&mut self, message: &str)
[src]
Send pong frame
fn close(&mut self, code: CloseCode, reason: &str)
[src]
Send close frame
fn drain(&mut self) -> Drain<A>
[src]
Returns drain future
fn connected(&self) -> bool
[src]
Check if connection still open
Trait Implementations
impl<A, S> ActorContext for WebsocketContext<A, S> where
A: Actor<Context = Self>,
[src]
A: Actor<Context = Self>,
fn stop(&mut self)
[src]
Gracefully stop actor execution
fn terminate(&mut self)
[src]
Terminate actor execution
fn state(&self) -> ActorState
[src]
Actor execution state
fn alive(&self) -> bool
[src]
Check if execution context is alive
impl<A, S> AsyncContext<A> for WebsocketContext<A, S> where
A: Actor<Context = Self>,
[src]
A: Actor<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 address<Address>(&mut self) -> Address where
A: ActorAddress<A, Address>,
[src]
A: ActorAddress<A, Address>,
Get actor address
fn add_future<F>(&mut self, fut: F) where
A: Handler<Result<<F as Future>::Item, <F as Future>::Error>>,
F: Future + 'static,
<F as Future>::Item: ResponseType,
[src]
A: Handler<Result<<F as Future>::Item, <F as Future>::Error>>,
F: Future + 'static,
<F as Future>::Item: ResponseType,
This method allow to handle Future in similar way as normal actor messages. Read more
fn add_stream<S>(&mut self, fut: S) where
A: Handler<Result<<S as Stream>::Item, <S as Stream>::Error>>,
S: Stream + 'static,
<S as Stream>::Item: ResponseType,
[src]
A: Handler<Result<<S as Stream>::Item, <S as Stream>::Error>>,
S: Stream + 'static,
<S as Stream>::Item: ResponseType,
This method is similar to add_future
but works with streams. 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: ResponseType,
[src]
A: Handler<<S as Stream>::Item>,
S: Stream<Error = ()> + 'static,
<S as Stream>::Item: ResponseType,
This method is similar to add_stream
but it skips result error. Read more
fn notify<M>(&mut self, msg: M) where
A: Handler<M>,
M: ResponseType + 'static,
[src]
A: Handler<M>,
M: ResponseType + 'static,
Send message msg
to self.
fn notify_later<M>(&mut self, msg: M, after: Duration) -> SpawnHandle where
A: Handler<M>,
M: ResponseType + 'static,
[src]
A: Handler<M>,
M: ResponseType + '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, S> ToEnvelope<A> for WebsocketContext<A, S> where
A: Actor<Context = WebsocketContext<A, S>>,
[src]
A: Actor<Context = WebsocketContext<A, S>>,