WebSocketBaseΒΆ
Defined in dccd.transport.ws
- class WebSocketBase(url)[source]
Bases:
objectBase async WebSocket client with exponential reconnect.
Subclasses override
on_connectto send subscription messages andparse_messageto yield domain records from raw frames.For adapters that need a raw-frame async generator (e.g. to maintain local order-book state across messages), use
stream_rawinstead.- Parameters:
- urlstr
WebSocket endpoint URL.
- async on_connect(ws)[source]
Called once after each (re)connect. Override to send subscriptions.
- async parse_message(raw)[source]
Parse a raw frame and yield domain records. Override in subclass.
- stop()[source]
Request graceful shutdown.
- async stream()[source]
Yield parsed domain records, reconnecting on errors.
Delegates to
parse_messagefor frame parsing.
- async stream_raw()[source]
Yield raw WebSocket frames, reconnecting with exponential backoff.
Use this in adapters where
parse_messageis not convenient (e.g. stateful order-book reconstruction that spans multiple frames).