Constructor
new PacketProcessorConfig(handlers, defaultProcessors)
Creates a packet processor configuration.
Parameters:
Name | Type | Description |
---|---|---|
handlers |
object.<string, function()> | Specified message handlers map by message type. |
defaultProcessors |
Array.<function()> | The default message processors. |
- Source:
Methods
addCatchAllProcessor(handler)
Adds an handler for all message types.
Parameters:
Name | Type | Description |
---|---|---|
handler |
function | The default message processors. |
- Source:
addProcessor(msgId, handler)
Adds an handler for the specified message type.
Parameters:
Name | Type | Description |
---|---|---|
msgId |
number | A byte representing the message type. |
handler |
function | A function(Packet) to be executed when receiving a packet with the message type. |
- Source: