Main Objects
- class goxlr.socket.Socket(host, port)
A class for handling the websocket connection to the daemon. It also handles the heartbeat task and the response queue. The response queue is used to ensure that the correct response is returned for a specific request.
- Parameters:
host – The host/IP address of the daemon.
port – The port of the daemon.
- async open()
Connects to the daemon and starts the heartbeat task.
- Returns:
True if the connection was successful, False otherwise.
- async send(payload, id=None)
Sends a payload to the daemon and waits for a response.
- Parameters:
payload – The payload to send to the daemon.
id – The ID of the payload. If not specified, it will automatically generate one. Used purely for identifying the correct response, considering that this is an async function and responses may come in out of order.
- Returns:
The response from the daemon.
- async receive(id=None)
Waits for a response from the daemon. If an ID is specified, it will wait until it receives a response with the same ID and queue all other responses.
- Parameters:
id (IDType | int) – The ID of the response to wait for. If not specified, it will wait for the first response and will not add it to the queue.
- Returns:
The response from the daemon.
- Raises:
DaemonError if the daemon returns an error.
- async receive_patch()
Helper method to wait for a patch message from the daemon.
- Returns:
The patch from the daemon.
- Return type:
List[Patch]
- async close()
Closes the connection to the daemon.
- Returns:
True if the connection was closed, False otherwise.
- async connect()
Alias for open().
- Returns:
True if the connection was successful, False otherwise.
- async disconnect()
Alias for close().
- Returns:
True if the connection was closed, False otherwise.
- class goxlr.socket.GoXLR(host='localhost', port=14564, serial=None)
A class for interacting with the GoXLR Utility daemon.
- async ping()
Pings the GoXLR Utility daemon.
- Returns:
“Ok” if the daemon is running.
- async update()
Gets the latest data from the GoXLR Utility daemon and updates the status and mixers attributes.
- Returns:
The status of the daemon.
- Raises:
DaemonError – If the daemon is not running.
MixerNotFoundError – If the specified mixer is not found.
- Note:
This method is automatically called when the class is instantiated. You should manually call this method periodically to ensure that the data is up to date.
- async receive_patch(update=True)
Helper method to wait for a patch message from the daemon.
- Parameters:
update (bool) – Whether or not to update the status and mixers attributes after receiving the patch.
- Returns:
The patch from the daemon.
- Return type:
List[Patch]
- select_mixer(serial=None)
Chooses a mixer to interact with.
- Parameters:
serial (str) – The serial number of the mixer to interact with. If not specified, it will default to the first mixer.
- Returns:
The selected mixer.
- Raises:
DaemonError – If no mixers are found.
MixerNotFoundError – If the specified mixer is not found.
- async open()
Connects to the GoXLR Utility daemon and gets the latest data.
- Returns:
True if the connection was successful, False otherwise.
- Raises:
DaemonError – If no mixers are found.
- async connect()
Alias for open().
- Returns:
True if the connection was successful, False otherwise.