From 1f407f10057a2fbe7948fe7f16f14f13cf5ef76e Mon Sep 17 00:00:00 2001 From: Naja Melan Date: Sat, 21 Mar 2020 17:13:57 +0100 Subject: [PATCH] feat: Allow reading the configuration. This allows wrapper types to correctly split data before creating websocket messages, guaranteeing to respect the max size. Notably when the WebSocket is provided by user code. --- src/protocol/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/protocol/mod.rs b/src/protocol/mod.rs index 7aed59c..6803100 100644 --- a/src/protocol/mod.rs +++ b/src/protocol/mod.rs @@ -111,6 +111,11 @@ impl WebSocket { self.context.set_config(set_func) } + /// Read the configuration. + pub fn get_config(&self) -> &WebSocketConfig { + self.context.get_config() + } + /// Check if it is possible to read messages. /// /// Reading is impossible after receiving `Message::Close`. It is still possible after @@ -254,6 +259,11 @@ impl WebSocketContext { set_func(&mut self.config) } + /// Read the configuration. + pub fn get_config(&self) -> &WebSocketConfig { + &self.config + } + /// Check if it is possible to read messages. /// /// Reading is impossible after receiving `Message::Close`. It is still possible after