1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-31 08:57:00 +02:00

use Optional with websocket close reason

This commit is contained in:
Nathan Fox
2018-04-21 16:50:27 -04:00
parent 2adf8a3a48
commit de8a09254d
6 changed files with 87 additions and 67 deletions

View File

@@ -15,7 +15,7 @@ use error::{Error, ErrorInternalServerError};
use httprequest::HttpRequest;
use ws::frame::Frame;
use ws::proto::{CloseCode, OpCode};
use ws::proto::{CloseReason, OpCode};
/// Execution context for `WebSockets` actors
pub struct WebsocketContext<A, S = ()>
@@ -177,8 +177,8 @@ where
/// Send close frame
#[inline]
pub fn close(&mut self, code: CloseCode, reason: &str) {
self.write(Frame::close(code, reason, false));
pub fn close(&mut self, reason: Option<CloseReason>) {
self.write(Frame::close(reason, false));
}
/// Returns drain future