azad.slipstream.base Module¶
azad.slipstream.base ¶
Attributes¶
Classes¶
SlipstreamError ¶
Bases: Exception
Base exception class for all slipstream errors.
ConnectionClosedError ¶
Bases: SlipstreamError
Raised when connection is closed normally (e.g. server shutdown).
Source code in azad/slipstream/base.py
ConnectionLostError ¶
Bases: SlipstreamError
Raised when connection is lost unexpectedly.
Source code in azad/slipstream/base.py
ProtocolError ¶
Bases: SlipstreamError
Raised when there is a protocol-level error.
ConnectionState ¶
MessageType ¶
Bases: Enum
Message types supported by the protocol.
FrameModel ¶
Bases: BaseModel
Attributes¶
Functions¶
validate_peer_id ¶
Source code in azad/slipstream/base.py
BiStreamHandle ¶
BiStreamHandle(protocol: Protocol, request_id: Tuple[str, int])
Manages a bi-directional stream with a particular request_id.
Source code in azad/slipstream/base.py
Attributes¶
Functions¶
send
async
¶
Send data to remote side as STREAM_DATA.
Source code in azad/slipstream/base.py
aclose
async
¶
Close our side of the stream (send STREAM_END).
Protocol ¶
Complete, decorator-based protocol implementation.
Source code in azad/slipstream/base.py
Attributes¶
Functions¶
set_handler ¶
set_handler(handler: ProtocolHandler)
Attach a user-defined handler that has @request_response, etc. methods.
listen
async
¶
Reads messages from the websocket and dispatches them.
Source code in azad/slipstream/base.py
request_response
async
¶
Send a single request, wait for single response.
Source code in azad/slipstream/base.py
request_stream
async
¶
Send a request, get an async iterator of incoming items.
Source code in azad/slipstream/base.py
stream_stream
async
¶
stream_stream(data: dict) -> BiStreamHandle
Initiate a bi-directional stream, returning a handle.
Source code in azad/slipstream/base.py
ProtocolHandler ¶
A base class if you want to store reference to protocol, or do custom logic. Typically you just define your methods with the decorators directly.
Source code in azad/slipstream/base.py
Functions¶
validate_incoming_frame ¶
validate_incoming_frame(frame_data: str) -> FrameModel
Convert raw JSON → dict → FrameModel, raising if invalid.