Skip to main content

Interface IMessageReceiver

An object that can receive messages

Syntax
public interface IMessageReceiver

Methods

RegisterHandler<T>(MessageDelegateWithPlayer<T>, Boolean)

Registers a handler for a network message that has INetworkPlayer and T Message parameters

When network message are sent, the first 2 bytes are the Id for the type T. When message is received the handler with the matching Id is found and invoked

Declaration
void RegisterHandler<T>(MessageDelegateWithPlayer<T> handler, bool allowUnauthenticated)
Parameters
TypeNameDescription
Mirage.MessageDelegateWithPlayer<T>handler
System.BooleanallowUnauthenticated

UnregisterHandler<T>()

Declaration
void UnregisterHandler<T>()

ClearHandlers()

Declaration
void ClearHandlers()

HandleMessage(INetworkPlayer, ArraySegment<Byte>)

Declaration
void HandleMessage(INetworkPlayer player, ArraySegment<byte> packet)
Parameters
TypeNameDescription
Mirage.INetworkPlayerplayer
System.ArraySegment<System.Byte>packet