Merge pull request #112 from najamelan/feature/get_config

Feature/get config
pull/115/head
Daniel Abramov 5 years ago committed by GitHub
commit 431b6d9241
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      src/protocol/mod.rs

@ -111,6 +111,11 @@ impl<Stream> WebSocket<Stream> {
self.context.set_config(set_func) 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. /// Check if it is possible to read messages.
/// ///
/// Reading is impossible after receiving `Message::Close`. It is still possible after /// Reading is impossible after receiving `Message::Close`. It is still possible after
@ -254,6 +259,11 @@ impl WebSocketContext {
set_func(&mut self.config) set_func(&mut self.config)
} }
/// Read the configuration.
pub fn get_config(&self) -> &WebSocketConfig {
&self.config
}
/// Check if it is possible to read messages. /// Check if it is possible to read messages.
/// ///
/// Reading is impossible after receiving `Message::Close`. It is still possible after /// Reading is impossible after receiving `Message::Close`. It is still possible after
@ -400,9 +410,7 @@ impl WebSocketContext {
} }
self.write_pending(stream) self.write_pending(stream)
} }
}
impl WebSocketContext {
/// Try to decode one message frame. May return None. /// Try to decode one message frame. May return None.
fn read_message_frame<Stream>(&mut self, stream: &mut Stream) -> Result<Option<Message>> fn read_message_frame<Stream>(&mut self, stream: &mut Stream) -> Result<Option<Message>>
where where

Loading…
Cancel
Save