pub struct ProtocolServer { /* private fields */ }Expand description
Multi-protocol server that can handle WebSocket and HTTP protocols
Implementations§
Source§impl ProtocolServer
impl ProtocolServer
pub fn new( config: ServerConfig, engine: StandardEngine, scheduler: SchedulerService, ) -> Self
Sourcepub fn with_websocket(&mut self) -> &mut Self
pub fn with_websocket(&mut self) -> &mut Self
Add WebSocket protocol support
Sourcepub fn start(&mut self) -> Result<(), ProtocolError>
pub fn start(&mut self) -> Result<(), ProtocolError>
Start the multi-protocol server
Sourcepub fn detect_protocol(&self, buffer: &[u8]) -> Option<&str>
pub fn detect_protocol(&self, buffer: &[u8]) -> Option<&str>
Detect which protocol should handle a connection
Sourcepub fn websocket_handler(&self) -> Option<&WebSocketHandler>
pub fn websocket_handler(&self) -> Option<&WebSocketHandler>
Get WebSocket handler if enabled
Sourcepub fn http_handler(&self) -> Option<&HttpHandler>
pub fn http_handler(&self) -> Option<&HttpHandler>
Get HTTP handler if enabled
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if server is running
Sourcepub fn config(&self) -> &ServerConfig
pub fn config(&self) -> &ServerConfig
Get server configuration
Sourcepub fn get_enabled_protocols(&self) -> Vec<String>
pub fn get_enabled_protocols(&self) -> Vec<String>
Get list of enabled protocols
Auto Trait Implementations§
impl Freeze for ProtocolServer
impl !RefUnwindSafe for ProtocolServer
impl Send for ProtocolServer
impl Sync for ProtocolServer
impl Unpin for ProtocolServer
impl !UnwindSafe for ProtocolServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more