Table of Contents

Interface IConnectionHandler

Namespace
Shard.Network
Assembly
Shard.Network.dll

Handles the lifecycle and inbound packets of a single IChannelConnection. Mirrors the Java ConnectionHandler: the server installs an initial handler on a new connection and handlers swap themselves as the connection advances (handshake → auth → play).

public interface IConnectionHandler

Methods

Closed(string?)

Called when the connection has closed; reason is best-effort.

void Closed(string? reason)

Parameters

reason string

Handle(int, IToServerPacket)

Called for each decoded inbound client-to-server packet and its validated wire ID.

void Handle(int packetId, IToServerPacket packet)

Parameters

packetId int
packet IToServerPacket

Registered(IChannelConnection)

Called once when this handler is attached to a connection.

void Registered(IChannelConnection connection)

Parameters

connection IChannelConnection

Unregistered()

Called when this handler is detached (replaced or connection gone).

void Unregistered()