跳转到正文

original_packets API ​

完整接口目录 · 协议包用法 · 工具包下载

模块说明 ​

text
Ordered original custom/JSON packet bytes plus normalized player state/Text.

This is not game wire format. The Host selects packet IDs and independently
requires permission for the complete mixed stream. Apply each returned item
before requesting another. No retry, background reader or plugin dispatch here.

MAX_PACKET_BYTES ​

python
MAX_PACKET_BYTES = 1 << 20

CUSTOM_FORMAT ​

python
CUSTOM_FORMAT = 'tooldelta-custom-v1'

JSON_FORMAT ​

python
JSON_FORMAT = 'neomega-json-v1'

OriginalPackets ​

python
class OriginalPackets(PlayerEvents)

SDK 说明:

text
open returns (stream, snapshot); next/poll return an ordered event.

Packet events contain packet={id, format, data}; data is immutable bytes.
Other events retain the PlayerEvents schema. The shared transport verifies
hashes, unique JSON fields, sequence/revision continuity and bounded chunks.
A failed operation seals the stream; explicit close must still be awaited.
One encoded document is bounded at 32MiB; JSON and decoded bytes are extra.
Packet payload decoding is bounded to 1MiB, checked before decoding.

OriginalPackets.__init__ ​

python
def __init__(self, peer, session)

继承自 player_observations.PlayerObservations.__init__。

OriginalPackets.open ​

python
@classmethod
async def open(cls, peer, session, **options)

SDK 说明:

text
Return (stream, snapshot). Caller must close stream on every exit.

继承自 player_observations.PlayerObservations.open。

OriginalPackets.next ​

python
async def next(self)

SDK 说明:

text
Acknowledge the previously applied document, then read its successor.

继承自 player_observations.PlayerObservations.next。

OriginalPackets.poll ​

python
async def poll(self)

SDK 说明:

text
Return an update or None on idle; requires catalog poll_wait_ms support.

Idle retains the acknowledged cursor. No automatic polling loop or sleep.
The host limits source waiting to 100ms; encoding/transport are additional.

继承自 player_observations.PlayerObservations.poll。

OriginalPackets.close ​

python
async def close(self)

SDK 说明:

text
Await explicit release. Failure may be retried; no success is inferred.

继承自 player_observations.PlayerObservations.close。

Neomega · 使用、开发与参考文档