PacketTransport

trait PacketTransport[F[_]]

The interface providing read/write operations on serialized packet data.

The minecraft protocol has optional compression and encryption, and this interface is there to abstract away details about how packet data is transmitted between client and server.

class Object
trait Matchable
class Any

Value members

Abstract methods

def readOnePacket: F[(PacketId, Chunk[Byte])]

Read data of a single packet from the underlying data source.

Read data of a single packet from the underlying data source.

This action

  • can semantically block until a packet is available from the peer
  • must not read more bytes than required to construct a single packet
  • must acquire mutex guard of the data source to avoid multiple reads occurring at once
  • should return the entire chunk that corresponds to a packet, so that the next read will produce valid PacketID-PacketData sequence
def write(id: PacketId, data: Chunk[Byte]): F[Unit]

Write data of a single packet to the peer.

Write data of a single packet to the peer.

This action must acquire mutex guard of the underlying write buffer to avoid multiple writes occurring at once.