Relay.Client
Relay.Client
Relay.Client is the basic connection to RELAY, allowing you send commands to RELAY and setup handlers for inbound events.
Constructor
Constructs a client object to interact with RELAY.
Parameters
Examples
Create a Client to interact with the RELAY API:
Properties
Methods
connect
Activates the connection to the RELAY API. The connection to RELAY does not happen automatically so that you can setup handlers to events that might occur before the connection is successfully established.
Returns
None
Examples
disconnect
Coroutine that close the RELAY connection, cancel the pending tasks and stop the event loop.
Returns
awaitable - A coroutine object.
Examples
Within an async function:
Scheduling a new asyncio task:
on
Attach an event handler for a specific type of event. The handler could be a coroutine or a normal function.
Parameters
Returns
Relay.Client - The client object itself.
Examples
Subscribe to the ready event:
off
Remove an event handler that were attached with .on(). If no handler parameter is passed, all listeners for that event will be removed.
Parameters
Returns
Relay.Client - The client object itself.
Examples
Subscribe to the ready event and then, remove the handler:
Events
All available events you can attach a listener on.