pub struct AroraWSServer { /* private fields */ }Expand description
WebSocket server bridging the Arora API.
Handles connections, parses messages, and dispatches to registered handlers. Supports at most one active client at a time – when a new client connects, the previous one is disconnected.
Implementations§
Source§impl AroraWSServer
impl AroraWSServer
Sourcepub fn new(config: ServerConfig) -> Self
pub fn new(config: ServerConfig) -> Self
Create a new server with the given configuration.
Sourcepub async fn set_write_values_handler<F>(&self, handler: F)
pub async fn set_write_values_handler<F>(&self, handler: F)
Set the write-values handler callback. This is called whenever a valid WriteValues message is received.
Sourcepub async fn set_read_values_handler(&self, handler: ReadValuesHandler)
pub async fn set_read_values_handler(&self, handler: ReadValuesHandler)
Set the read-values handler callback. This is called whenever a valid ReadValues message is received.
Sourcepub async fn set_on_client_connected_handler(
&self,
handler: OnClientConnectedHandler,
)
pub async fn set_on_client_connected_handler( &self, handler: OnClientConnectedHandler, )
Set the handler called when a new client connects.
Sourcepub async fn disconnect_client(&self)
pub async fn disconnect_client(&self)
Disconnect the current active client (if any).
Sourcepub async fn is_running(&self) -> bool
pub async fn is_running(&self) -> bool
Check if the server is running.
Sourcepub async fn run(&self, cancel_token: CancellationToken) -> Result<(), String>
pub async fn run(&self, cancel_token: CancellationToken) -> Result<(), String>
Run the server until the cancellation token is triggered.
Sourcepub fn connection_id(&self) -> String
pub fn connection_id(&self) -> String
Get the connection identifier.
Auto Trait Implementations§
impl !Freeze for AroraWSServer
impl !RefUnwindSafe for AroraWSServer
impl !UnwindSafe for AroraWSServer
impl Send for AroraWSServer
impl Sync for AroraWSServer
impl Unpin for AroraWSServer
impl UnsafeUnpin for AroraWSServer
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