azad.slipstream.websocket Module¶
azad.slipstream.websocket ¶
WebSocket-based network protocol implementation.
Attributes¶
Classes¶
ProtocolCallbacks ¶
Bases: Protocol
Protocol interface defining required callback methods.
NetworkProtocol ¶
Bases: Protocol
Network protocol interface.
Functions¶
start_server
async
¶
start_server(port: int, callbacks: ProtocolCallbacks) -> None
WebSocketNetworkProtocol ¶
WebSocketNetworkProtocol(handler_class: Optional[Callable[[Any], ProtocolHandler]] = None)
Bases: NetworkProtocol
WebSocket-based implementation of the NetworkProtocol interface.
Initialize the protocol.
Parameters:
-
handler_class(Optional[Callable[[Any], ProtocolHandler]], default:None) –Optional factory function to create protocol handlers. If not provided, a default handler will be used.
Source code in azad/slipstream/websocket.py
Functions¶
start_server
async
¶
Start the WebSocket server.
Parameters:
-
port(int) –Port to listen on
-
host(Optional[str]) –Host to bind to
Source code in azad/slipstream/websocket.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
stop_server
async
¶
Stop the WebSocket server.
Parameters:
-
grace_period(float, default:5.0) –Shutdown grace period in seconds