diff --git a/src/ws/mod.rs b/src/ws/mod.rs index 05099971e..4fb1eecaa 100644 --- a/src/ws/mod.rs +++ b/src/ws/mod.rs @@ -171,18 +171,28 @@ pub enum Message { } /// Do websocket handshake and start actor -pub fn start(req: &HttpRequest, actor: A) -> Result +#[inline] +pub fn create(req: &HttpRequest, actor: A, max_size: usize) -> Result where A: Actor> + StreamHandler, S: 'static, { let mut resp = handshake(req)?; - let stream = WsStream::new(req.payload()); + let stream = WsStream::new(req.payload()).max_size(max_size); let body = WebsocketContext::create(req.clone(), actor, stream); Ok(resp.body(body)) } +/// Do websocket handshake and start actor +pub fn start(req: &HttpRequest, actor: A) -> Result +where + A: Actor> + StreamHandler, + S: 'static, +{ + create(req, actor, 65_536) +} + /// Prepare `WebSocket` handshake response. /// /// This function returns handshake `HttpResponse`, ready to send to peer.