Function actix_web_actors::ws::start_with_addr

source ยท
pub fn start_with_addr<A, T>(
    actor: A,
    req: &HttpRequest,
    stream: T
) -> Result<(Addr<A>, HttpResponse), Error>
where A: Actor<Context = WebsocketContext<A>> + StreamHandler<Result<Message, ProtocolError>>, T: Stream<Item = Result<Bytes, PayloadError>> + 'static,
๐Ÿ‘ŽDeprecated since 4.0.0: Prefer WsResponseBuilder::start_with_addr.
Expand description

Perform WebSocket handshake and start actor.

req is an HTTP Request that should be requesting a websocket protocol change. stream should be a Bytes stream (such as actix_web::web::Payload) that contains a stream of the body request.

If there is a problem with the handshake, an error is returned.

If successful, returns a pair where the first item is an address for the created actor and the second item is the response that should be returned from the WebSocket request.