mirror of https://github.com/fafhrd91/actix-web
do not use try_trait in main
This commit is contained in:
parent
31500fffcd
commit
178d2e846d
14
src/main.rs
14
src/main.rs
|
@ -61,10 +61,16 @@ impl Route for MyWS {
|
||||||
|
|
||||||
fn request(req: HttpRequest, payload: Payload, ctx: &mut HttpContext<Self>) -> Reply<Self>
|
fn request(req: HttpRequest, payload: Payload, ctx: &mut HttpContext<Self>) -> Reply<Self>
|
||||||
{
|
{
|
||||||
let resp = ws::handshake(&req)?;
|
match ws::handshake(&req) {
|
||||||
ctx.start(resp);
|
Ok(resp) => {
|
||||||
ctx.add_stream(ws::WsStream::new(payload));
|
ctx.start(resp);
|
||||||
Reply::stream(MyWS{})
|
ctx.add_stream(ws::WsStream::new(payload));
|
||||||
|
Reply::stream(MyWS{})
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
Reply::reply(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue