1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-06-25 14:49:20 +02:00

ws services

This commit is contained in:
Nikolay Kim
2018-10-22 09:59:20 -07:00
parent 20c693b39c
commit 9b94eaa6a8
7 changed files with 284 additions and 20 deletions

View File

@ -52,7 +52,7 @@ fn test_simple() {
.and_then(|(req, framed): (_, Framed<_, _>)| {
// validate request
if let Some(h1::InMessage::Message(req, _)) = req {
match ws::handshake(&req) {
match ws::verify_handshake(&req) {
Err(e) => {
// validation failed
let resp = e.error_response();
@ -63,11 +63,12 @@ fn test_simple() {
.map(|_| ()),
)
}
Ok(mut resp) => Either::B(
Ok(_) => Either::B(
// send response
framed
.send(h1::OutMessage::Response(resp.finish()))
.map_err(|_| ())
.send(h1::OutMessage::Response(
ws::handshake_response(&req).finish(),
)).map_err(|_| ())
.and_then(|framed| {
// start websocket service
let framed =