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.
pull/112/head
Naja Melan 5 years ago
parent 17732694d4
commit 1f407f1005
  1. 10
      src/protocol/mod.rs

@ -111,6 +111,11 @@ impl<Stream> WebSocket<Stream> {
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

Loading…
Cancel
Save