Struct actix_web::ws::WebsocketContext [−][src]
Execution context for WebSockets
actors
Methods
impl<A, S: 'static> WebsocketContext<A, S> where
A: Actor<Context = Self>,
[src]
[−]
impl<A, S: 'static> WebsocketContext<A, S> where
A: Actor<Context = Self>,
pub fn create<P>(req: HttpRequest<S>, actor: A, stream: WsStream<P>) -> Body where
A: StreamHandler<Message, ProtocolError>,
P: Stream<Item = Bytes, Error = PayloadError> + 'static,
[src]
[−]
pub fn create<P>(req: HttpRequest<S>, actor: A, stream: WsStream<P>) -> Body where
A: StreamHandler<Message, ProtocolError>,
P: Stream<Item = Bytes, Error = PayloadError> + 'static,
Create a new Websocket context from a request and an actor
pub fn with_factory<F>(req: HttpRequest<S>, f: F) -> Body where
F: FnOnce(&mut Self) -> A + 'static,
[src]
[−]
pub fn with_factory<F>(req: HttpRequest<S>, f: F) -> Body where
F: FnOnce(&mut Self) -> A + 'static,
Create a new Websocket context
impl<A, S> WebsocketContext<A, S> where
A: Actor<Context = Self>,
[src]
[−]
impl<A, S> WebsocketContext<A, S> where
A: Actor<Context = Self>,
pub fn write_raw(&mut self, data: FramedMessage)
[src]
[−]
pub fn write_raw(&mut self, data: FramedMessage)
Write payload
This is a low-level function that accepts framed messages that should
be created using Frame::message()
. If you want to send text or binary
data you should prefer the text()
or binary()
convenience functions
that handle the framing for you.
ⓘImportant traits for &'a mut Rpub fn state(&self) -> &S
[src]
[−]
ⓘImportant traits for &'a mut R
pub fn state(&self) -> &S
Shared application state
pub fn request(&mut self) -> &mut HttpRequest<S>
[src]
[−]
pub fn request(&mut self) -> &mut HttpRequest<S>
Incoming request
pub fn drain(&mut self) -> Drain<A>
[src]
[−]
pub fn drain(&mut self) -> Drain<A>
Returns drain future
pub fn text<T: Into<Binary>>(&mut self, text: T)
[src]
[−]
pub fn text<T: Into<Binary>>(&mut self, text: T)
Send text frame
pub fn binary<B: Into<Binary>>(&mut self, data: B)
[src]
[−]
pub fn binary<B: Into<Binary>>(&mut self, data: B)
Send binary frame
pub fn ping(&mut self, message: &str)
[src]
[−]
pub fn ping(&mut self, message: &str)
Send ping frame
pub fn pong(&mut self, message: &str)
[src]
[−]
pub fn pong(&mut self, message: &str)
Send pong frame
pub fn close(&mut self, reason: Option<CloseReason>)
[src]
[−]
pub fn close(&mut self, reason: Option<CloseReason>)
Send close frame
pub fn connected(&self) -> bool
[src]
[−]
pub fn connected(&self) -> bool
Check if connection still open
pub fn handle(&self) -> SpawnHandle
[src]
[−]
pub fn handle(&self) -> SpawnHandle
Handle of the running future
SpawnHandle is the handle returned by AsyncContext::spawn()
method.
Trait Implementations
impl<A, S> ActorContext for WebsocketContext<A, S> where
A: Actor<Context = Self>,
[src]
[+]
impl<A, S> ActorContext for WebsocketContext<A, S> where
A: Actor<Context = Self>,
impl<A, S> AsyncContext<A> for WebsocketContext<A, S> where
A: Actor<Context = Self>,
[src]
[+]
impl<A, S> AsyncContext<A> for WebsocketContext<A, S> where
A: Actor<Context = Self>,
impl<A, S> WsWriter for WebsocketContext<A, S> where
A: Actor<Context = Self>,
S: 'static,
[src]
[+]
impl<A, S> WsWriter for WebsocketContext<A, S> where
A: Actor<Context = Self>,
S: 'static,
impl<A, S> AsyncContextParts<A> for WebsocketContext<A, S> where
A: Actor<Context = Self>,
[src]
[+]
impl<A, S> AsyncContextParts<A> for WebsocketContext<A, S> where
A: Actor<Context = Self>,
impl<A, M, S> ToEnvelope<A, M> for WebsocketContext<A, S> where
A: Actor<Context = WebsocketContext<A, S>> + Handler<M>,
M: ActixMessage + Send + 'static,
M::Result: Send,
[src]
[+]
impl<A, M, S> ToEnvelope<A, M> for WebsocketContext<A, S> where
A: Actor<Context = WebsocketContext<A, S>> + Handler<M>,
M: ActixMessage + Send + 'static,
M::Result: Send,
Auto Trait Implementations
impl<A, S = ()> !Send for WebsocketContext<A, S>
impl<A, S = ()> !Send for WebsocketContext<A, S>
impl<A, S = ()> !Sync for WebsocketContext<A, S>
impl<A, S = ()> !Sync for WebsocketContext<A, S>