Input events
Send an events array after connecting. Events apply immediately and have no acknowledgement. Activate PlayAbility’s main output and the output types your integration uses.
Press a button:
{"events":[{"type":"button","code":"A","value":true}]}Release it in a later message:
{"events":[{"type":"button","code":"A","value":false}]}Event fields
Section titled “Event fields”| Field | Meaning |
|---|---|
type | Event family below; case-sensitive |
code | Output identifier, using the exact spelling below |
value | Boolean, number or {x, y}, depending on the family |
delay | Optional hold duration in milliseconds, from 1 to 5000, then automatic release |
Events in one array run in order without a pause. delay does not postpone the press; it schedules its release. It is ignored for mouseScroll, mousePosition and reset. Use valid codes and values: malformed events may be ignored without an error response. Put commands at the root, not inside events.
Gamepad
Section titled “Gamepad”| Type | Codes | Value |
|---|---|---|
button | A, B, X, Y, LEFT_SHOULDER, RIGHT_SHOULDER, LEFT_THUMB, RIGHT_THUMB, BACK, START, GUIDE | true to press, false to release |
button | DPAD_UP, DPAD_DOWN, DPAD_LEFT, DPAD_RIGHT | Boolean |
button | LEFT_STICK_UP, LEFT_STICK_DOWN, LEFT_STICK_LEFT, LEFT_STICK_RIGHT, RIGHT_STICK_UP, RIGHT_STICK_DOWN, RIGHT_STICK_LEFT, RIGHT_STICK_RIGHT | Boolean or intensity 0–1 |
axis | leftX, leftY, rightX, rightY, dpadHorz, dpadVert, mouseX, mouseY | -1 to 1; 0 is neutral |
trigger | leftTrigger, rightTrigger | 0 to 1; use 0 to release |
Triggers currently act as on/off controls over WebSocket: a non-zero value produces 1, so intermediate pressure is not preserved. Stick directions accept progressive intensity. A physical gamepad can take priority over WebSocket controls.
D-pad axes also update directional buttons: dpadHorz < -0.5 is left and > 0.5 is right; dpadVert > 0.5 is up and < -0.5 is down. mouseX and mouseY control mouse motion state; use mousePosition for an absolute point.
Keyboard
Section titled “Keyboard”Use type: "keyboard" and a boolean value. These are PlayAbility names, not browser KeyboardEvent.code values.
| Group | Codes |
|---|---|
| Letters, digits, keypad | a–z, 0–9, numpad_0–numpad_9 |
| Editing and navigation | backspace, delete, enter, tab, escape, space, up, down, left, right, home, end, pageup, pagedown |
| Function keys | f1–f24 |
| Modifiers | alt, control, shift, windows, right_control, right_shift, right_alt, right_windows |
| Media and special | play, pause, mute, fn |
| Punctuation | grave, minus, equal, leftbracket, rightbracket, backslash, semicolon, quote, comma, period, slash |
Send several events for a chord, then release every key. The operating system and keyboard layout determine the characters produced.
| Type | Codes | Value |
|---|---|---|
mouseButton | leftClick, middleClick, rightClick, leftDoubleClick, middleDoubleClick, rightDoubleClick | Boolean; double-click triggers on press |
mouseButton | scrollUp, scrollDown | Legacy boolean scrolling state |
mouseMotionOut | mouseMotionOut, mouseLeft, mouseRight, mouseUp, mouseDown | Boolean motion state |
mouseScroll | up, down, left, right | Positive amount, usually 120; immediate action, no release |
mousePosition | mousePosition | {x: 100, y: 200} in logical display coordinates |
For scrolling, a zero or absent amount uses 120; it does not stop scrolling. Amounts are not pixel counts. For position, coordinates are limited to the current display dimensions and adjusted for its scale factor. They are not unrestricted global desktop coordinates; see displays and cursor.
Settings and release
Section titled “Settings and release”A legacy setting event toggles the named setting on a false → true transition. Send false before triggering it again. For explicit values and a response, prefer SET_SETTING. Use MCP_SWITCH_PROFILE to activate a named profile.
An event with type: "reset" resets control state; it needs no code or value. For a full release, send {"type":"SET_SETTING","key":"releaseAll","value":true}. Controls are not automatically released when a socket disconnects, so release them before closing and provide a recovery action in your integration.
See the examples for complete clients and the AsyncAPI specification for message schemas.