Skip to main content

on_event

Method
This is a method of the GatewayProtocol class in the protocols module.
Decorator to register an event handler.

Signature

def on_event(event_type: Union[EventType, str]) -> Callable

Parameters

event_type
Union
required
No description available.

Returns

Returns
Callable
The result of the operation.

Usage

@gateway.on_event(EventType.MESSAGE)
    async def handle_message(event: GatewayEvent):
        print(f"Message: {event.data}")