azad.slipstream.server Module¶
azad.slipstream.server ¶
WebSocket server implementation.
Attributes¶
Classes¶
WebSocketServer ¶
WebSocketServer(handler_class: Callable[[Any], ProtocolHandler], host: str = 'localhost', port: int = 8765)
Initialize the WebSocket server.
Parameters:
-
handler_class(Callable[[Any], ProtocolHandler]) –Factory function that takes callbacks and returns a ProtocolHandler
-
host(str, default:'localhost') –The host to bind to
-
port(int, default:8765) –The port to listen on
Source code in azad/slipstream/server.py
Attributes¶
Functions¶
handle_connection
async
¶
Handle an incoming WebSocket connection.
Parameters:
-
websocket–The WebSocket connection to handle
Source code in azad/slipstream/server.py
start
async
¶
Start the WebSocket server.
Source code in azad/slipstream/server.py
stop
async
¶
Stop the WebSocket server.
Source code in azad/slipstream/server.py
create
async
classmethod
¶
create(handler_class: Callable[[Any], ProtocolHandler], host: str = 'localhost', port: int = 8765)
Create and start a new WebSocket server.
Parameters:
-
handler_class(Callable[[Any], ProtocolHandler]) –The ProtocolHandler class to use for new connections
-
host(str, default:'localhost') –The host to bind to
-
port(int, default:8765) –The port to listen on
Returns:
-
–
A running WebSocketServer instance
Source code in azad/slipstream/server.py
Functions¶
run_server
async
¶
run_server(handler_class: Callable[[Any], ProtocolHandler], host: str = 'localhost', port: int = 8765)
Run a WebSocket server until interrupted.
Parameters:
-
handler_class(Callable[[Any], ProtocolHandler]) –The ProtocolHandler class to use for new connections
-
host(str, default:'localhost') –The host to bind to
-
port(int, default:8765) –The port to listen on