network.serializers - Palamecia/mint GitHub Wiki

Module network.serializers

Description

This module describes the serializer contract used by the network channel classes.

A serializer implementation converts between message objects and byte streams represented by Serializer.DataStream. The same contract is used by Network.Channel, Network.AsyncChannel, and Network.EventChannel.

The core synchronous interface consists of the following methods:

  • appendMessage to queue a message in the serializer buffer.
  • nextMessage and containsMessage to decode and inspect complete messages.
  • read, write, and accept to exchange data with an underlying socket or accepted peer.

For coroutine-based code, a second implementation may also provide async variants. The methods suspend until more data becomes available or a connection is accepted, and they are used by Network.AsyncChannel. Event-driven code typically relies on the synchronous interface together with the channel layer's readiness handling.

Packages

Classes