A class that dispatches messages to handlers based on their schema.
An object that dispatches messages to handlers based on their schema.
add_message_type(self, validator, callback)¶
Add a message type that should trigger a callback.
Each validator must be unique, in that a message will be dispatched to the first callback whose validator matches the message.
- validator (Verifier): A schema verifier that will
- validate a received message uniquely
- callback (callable): The function that should be called
- when a message that matches validator is received.
Dispatch a message to a callback based on its schema.
- message (dict): The message to dispatch