mirror of
https://github.com/fafhrd91/actix-web
synced 2025-01-18 13:51:50 +01:00
do not use try_trait in main
This commit is contained in:
parent
31500fffcd
commit
178d2e846d
@ -61,11 +61,17 @@ 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) {
|
||||||
|
Ok(resp) => {
|
||||||
ctx.start(resp);
|
ctx.start(resp);
|
||||||
ctx.add_stream(ws::WsStream::new(payload));
|
ctx.add_stream(ws::WsStream::new(payload));
|
||||||
Reply::stream(MyWS{})
|
Reply::stream(MyWS{})
|
||||||
}
|
}
|
||||||
|
Err(err) => {
|
||||||
|
Reply::reply(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ResponseType<ws::Message> for MyWS {
|
impl ResponseType<ws::Message> for MyWS {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user