MessageHandlerAttribute Class
Namespace: Riptide
Assembly: RiptideNetworking.dll
Specifies a method as the message handler for messages with the given ID.
[AttributeUsage(AttributeTargets.Method, Inherited = false, AllowMultiple = false)]
public sealed class MessageHandlerAttribute : Attribute
Remarks
In order for a method to qualify as a message handler, it must match a valid message handler method signature. Servers will only use methods marked with this attribute if they match the Server.MessageHandler signature, and Clients will only use methods marked with this attribute if they match the Client.MessageHandler signature.
Methods marked with this attribute which match neither of the valid message handler signatures will not be used by Servers or Clients and will cause warnings at runtime.
If you want a Server or Client to only use a subset of all message handler methods, you can do so by setting up custom message handler groups. Simply set the group ID in the MessageHandlerAttribute(ushort, byte) constructor and pass the same value to the Start(ushort, ushort, byte, bool) or Connect(string, int, byte, Message, bool) method. This will make that Server or Client only use message handlers which have the same group ID.
Inherited Members
Constructors
MessageHandlerAttribute(ushort, byte) | Initializes a new instance of the MessageHandlerAttribute class with the |
Fields
GroupId | The ID of the group of message handlers which this method belongs to. |
MessageId | The ID of the message type which this method is meant to handle. |