Skip to main content

Class MessageReceiverExtensions

Inheritance
System.Object
Inherited Members
Show
Syntax
public static class MessageReceiverExtensions

Methods

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

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
public static void RegisterHandler<T>(this IMessageReceiver receiver, MessageDelegateWithPlayer<T> handler)
Parameters
TypeNameDescription
Mirage.IMessageReceiverreceiver
Mirage.MessageDelegateWithPlayer<T>handler

RegisterHandler<T>(IMessageReceiver, MessageDelegate<T>, Boolean)

Registers a handler for a network message that has just T Message parameter

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
public static void RegisterHandler<T>(this IMessageReceiver receiver, MessageDelegate<T> handler, bool allowUnauthenticated = false)
Parameters
TypeNameDescription
Mirage.IMessageReceiverreceiver
Mirage.MessageDelegate<T>handler
System.BooleanallowUnauthenticated

RegisterHandler<T>(IMessageReceiver, MessageDelegateWithPlayerAsync<T>, Boolean)

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

This allows for async handles without allocations

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
public static void RegisterHandler<T>(this IMessageReceiver receiver, MessageDelegateWithPlayerAsync<T> handler, bool allowUnauthenticated = false)
Parameters
TypeNameDescription
Mirage.IMessageReceiverreceiver
Mirage.MessageDelegateWithPlayerAsync<T>handler
System.BooleanallowUnauthenticated

RegisterHandler<T>(IMessageReceiver, MessageDelegateAsync<T>, Boolean)

Registers a handler for a network message that has just T Message parameter and returns UniTaskVoid.

This allows for async handles without allocations

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
public static void RegisterHandler<T>(this IMessageReceiver receiver, MessageDelegateAsync<T> handler, bool allowUnauthenticated = false)
Parameters
TypeNameDescription
Mirage.IMessageReceiverreceiver
Mirage.MessageDelegateAsync<T>handler
System.BooleanallowUnauthenticated