Skip to content

Get started with WebSocket

Use the WebSocket API to connect a local application to PlayAbility, send controls, read settings, and receive output changes.

ws://127.0.0.1:13123

Your client and PlayAbility must run on the same computer. Keep PlayAbility running while your integration is connected.

Open WebSocket & MCP in PlayAbility’s Inputs/Connections panel and enable Enable WebSocket Server. Enable Require authentication key, then copy the nonempty key into your client’s secret storage.

Connect trusted local applications only. Keep the key out of public code and logs. The Allow WebSocket Inputs toggle is not an access-control boundary, and output state may reach connected clients before authentication. Leave output broadcasting off when you do not need it.

Open a WebSocket connection and wait for the greeting:

{"type":"CONNECT","info":"WebSocket Server Started","authRequired":true}

If authRequired is true, send your key before any other request:

{"type":"AUTH","key":"YOUR_AUTHENTICATION_KEY"}

Wait for:

{"type":"AUTH_OK"}

If authentication is enabled in PlayAbility but authRequired is false, check that the configured key is nonempty. Reconnect and authenticate again after changing the key.

Send a command as a JSON object with a top-level type:

{"type":"GET_SETTINGS"}

The response has type: "SETTINGS_STATE". Its data.settings contains the exposed settings; data.hints explains some of them. See the message reference for all commands and responses.

Responses and output events share the connection. Match messages by type and send requests one at a time. Input events have no execution acknowledgment.

For a control test, enable Allow WebSocket Inputs, Main Output, and the intended output type in PlayAbility. Always pair a press with a release; closing the connection does not release held controls.

ProblemWhat to check
Connection refusedPlayAbility is running, WebSocket is enabled, and your client uses 127.0.0.1:13123 on the same computer.
AUTH_ERROR or unauthorized errorUse the current key and wait for AUTH_OK before sending requests.
Controls have no effectCheck the event format, Main Output, the output type, and the target device.
No output messagesEnable Allow WebSocket Outputs; automatic messages report changes, so an idle state can remain silent.
A request times outCheck PlayAbility for a pending dialog. Read the current state before retrying an action that may already have completed.

After a disconnect, reconnect, authenticate, and refresh the state you need. Do not automatically replay button presses, imports, or other actions.