18 std::function<
void(
const Message&)> handler);
Routes incoming network messages to registered handlers.
Definition router.h:11
void unregister_handler(MessageType type)
Unregisters the handler associated with a message type.
void register_handler(MessageType type, std::function< void(const Message &)> handler)
Registers a handler for a specific message type. If the handler already exists, it will be overwritte...
void route(const Message &msg) const
Routes the message to its corresponding handler. If no handler exists, the message is ignored.
Represents a complete network message including type and payload.
Definition network_message.h:105
Represents either a default or custom message identifier.
Definition network_message.h:40