MessageHandlerBase
public class MessageHandlerBase<T>
A utility to parse binary messages and dispatch the parsed messages to registered handlers.
-
Registers a message handler. This is used to subscribe to a specific type of
Message
. A handler is a function that takes one generic argumentM
. The type of this argument indicates which messages you want to subscribe to.Declaration
Swift
public func when<M: Message>(_ handler: @escaping (M)->T)
Parameters
handler
The handler to register