[−][src]Function requiem_web_actors::ws::start_with_addr
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,
Do websocket handshake and start ws actor.
req
is an HTTP Request that should be requesting a websocket protocol
change. stream
should be a Bytes
stream (such as
requiem_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.