Disable keep-alive timeout for websockets endpoint

This commit is contained in:
Nikolay Kim 2022-04-05 16:58:23 -07:00
parent 5920154ae1
commit fb6c16fcb2
3 changed files with 8 additions and 4 deletions

View file

@ -2,7 +2,9 @@
## [0.5.16] - 2022-04-05
* Add keep-alive timeout support to websockets client
* ws: Add keep-alive timeout support to websockets client
* web: Disable keep-alive timeout for websockets endpoint
## [0.5.15] - 2022-02-18

View file

@ -107,5 +107,5 @@ time = "0.3"
futures-util = "0.3"
tls-openssl = { version="0.10", package = "openssl" }
tls-rustls = { version = "0.20", package="rustls", features = ["dangerous_configuration"] }
rustls-pemfile = { version = "0.2" }
rustls-pemfile = { version = "0.3" }
webpki-roots = { version = "0.22" }

View file

@ -9,7 +9,7 @@ use crate::service::{
};
use crate::web::{HttpRequest, HttpResponse};
use crate::ws::{error::HandshakeError, error::WsError, handshake};
use crate::{io::DispatchItem, rt, util::Either, util::Ready, ws};
use crate::{io::DispatchItem, rt, time::Seconds, util::Either, util::Ready, ws};
/// Do websocket handshake and start websockets service.
pub async fn start<T, F, Err>(req: HttpRequest, factory: F) -> Result<HttpResponse, Err>
@ -98,7 +98,9 @@ where
// start websockets service dispatcher
rt::spawn(async move {
let res = crate::io::Dispatcher::new(io, codec, srv).await;
let res = crate::io::Dispatcher::new(io, codec, srv)
.keepalive_timeout(Seconds::ZERO)
.await;
log::trace!("Ws handler is terminated: {:?}", res);
});