外观
packet_subscriptions API
模块说明
text
Selected inbound packet subscriptions, separate from raw diagnostics.
Authorization is checked when the Host delivers a batch. Local iteration does
not reauthorize data already delivered. No reconnect, retry or raw fallback.MAX_EVENTS
python
MAX_EVENTS = 64MAX_BYTES
python
MAX_BYTES = 512 << 10PacketSubscriptionError
python
class PacketSubscriptionError(ProtocolError)SDK 说明:
text
The selected stream ended; ``reason`` identifies its terminal cause.PacketSubscriptionError.__init__
python
def __init__(self, reason)PacketSubscriptionError.reason
python
self.reason公开实例属性,在 __init__ 中设置。
TypedPacketEvent
python
@dataclass(frozen=True)
class TypedPacketEvent字段(包含继承字段):
TypedPacketEvent.sequence
python
sequence: int数据类字段;声明于 packet_subscriptions.TypedPacketEvent。
TypedPacketEvent.packet_id
python
packet_id: int数据类字段;声明于 packet_subscriptions.TypedPacketEvent。
TypedPacketEvent.model
python
model: object数据类字段;声明于 packet_subscriptions.TypedPacketEvent。
TypedPacketEvent.connection_id
python
connection_id: str数据类字段;声明于 packet_subscriptions.TypedPacketEvent。
TypedPacketEvent.schema_hash
python
schema_hash: str数据类字段;声明于 packet_subscriptions.TypedPacketEvent。
TypedPacketEvent.protocol_version
python
protocol_version: int数据类字段;声明于 packet_subscriptions.TypedPacketEvent。
TypedPacketEvent.codec_revision
python
codec_revision: int数据类字段;声明于 packet_subscriptions.TypedPacketEvent。
TypedPacketEvent.observed_at
python
observed_at: str数据类字段;声明于 packet_subscriptions.TypedPacketEvent。
PacketSubscription
python
class PacketSubscriptionSDK 说明:
text
Lazy async context manager, batch reader and serial async iterator.
``close`` discards local buffered events, joins an in-flight local read and
requests Host closure. A failed/timed-out IPC does not prove remote closure.
``listen`` returns a Worker-owned task; cancel and await it to stop callbacks.PacketSubscription.__init__
python
def __init__(
self,
context,
packet_types,
*,
max_events = MAX_EVENTS,
max_bytes = MAX_BYTES,
poll_interval = 0.025,
)PacketSubscription.snapshot
python
@property
def snapshot(self)PacketSubscription.open
python
async def open(self)PacketSubscription.poll_batch
python
async def poll_batch(self, *, max_events=None, max_bytes=None)SDK 说明:
text
Return available selected events; [] means idle. Bounds apply to IPC.PacketSubscription.__aiter__
python
def __aiter__(self)PacketSubscription.__anext__
python
async def __anext__(self)PacketSubscription.listen
python
async def listen(self, callback)SDK 说明:
text
Start one Worker-owned serial callback task and return it.PacketSubscription.close
python
async def close(self)PacketSubscription.__aenter__
python
async def __aenter__(self)PacketSubscription.__aexit__
python
async def __aexit__(self, *_)