pub struct WebsocketContext<A>where
    A: Actor<Context = WebsocketContext<A>>,
{ /* private fields */ }
Expand description

Execution context for WebSockets actors

Implementations§

Create a new Websocket context from a request and an actor.

Create a new Websocket context from a request and an actor.

Returns a pair, where the first item is an addr for the created actor, and the second item is a stream intended to be set as part of the response via HttpResponseBuilder::streaming().

Create a new Websocket context from a request, an actor, and a codec

Create a new Websocket context

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.

Send text frame

Send binary frame

Send ping frame

Send pong frame

Send close frame

Handle of the running future

SpawnHandle is the handle returned by AsyncContext::spawn() method.

Set mailbox capacity

By default mailbox capacity is 16 messages.

Trait Implementations§

Immediately stop processing incoming messages and switch to a stopping state. This only affects actors that are currently running. Future attempts to queue messages will fail.
Terminate actor execution unconditionally. This sets the actor into the stopped state. This causes future attempts to queue messages to fail.
Retrieve the current Actor execution state.
Spawns a future into the context. Read more
Spawns a future into the context, waiting for it to resolve. Read more
Cancels a spawned future. Read more
Returns the address of the context.
Checks if the context is paused (waiting for future completion or stopping).
Registers a stream with the context. Read more
Registers a stream with the context, ignoring errors. Read more
Sends the message msg to self. This bypasses the mailbox capacity, and will always queue the message. If the actor is in the stopped state, an error will be raised.
Sends the message msg to self after a specified period of time. Read more
Executes a closure after a specified period of time. Read more
Spawns a job to execute the given closure periodically, at a specified fixed interval.
Pack message into suitable envelope

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more