Skip to content

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}]}
FieldMeaning
typeEvent family below; case-sensitive
codeOutput identifier, using the exact spelling below
valueBoolean, number or {x, y}, depending on the family
delayOptional 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.

TypeCodesValue
buttonA, B, X, Y, LEFT_SHOULDER, RIGHT_SHOULDER, LEFT_THUMB, RIGHT_THUMB, BACK, START, GUIDEtrue to press, false to release
buttonDPAD_UP, DPAD_DOWN, DPAD_LEFT, DPAD_RIGHTBoolean
buttonLEFT_STICK_UP, LEFT_STICK_DOWN, LEFT_STICK_LEFT, LEFT_STICK_RIGHT, RIGHT_STICK_UP, RIGHT_STICK_DOWN, RIGHT_STICK_LEFT, RIGHT_STICK_RIGHTBoolean or intensity 0–1
axisleftX, leftY, rightX, rightY, dpadHorz, dpadVert, mouseX, mouseY-1 to 1; 0 is neutral
triggerleftTrigger, rightTrigger0 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.

Use type: "keyboard" and a boolean value. These are PlayAbility names, not browser KeyboardEvent.code values.

GroupCodes
Letters, digits, keypada–z, 0–9, numpad_0–numpad_9
Editing and navigationbackspace, delete, enter, tab, escape, space, up, down, left, right, home, end, pageup, pagedown
Function keysf1–f24
Modifiersalt, control, shift, windows, right_control, right_shift, right_alt, right_windows
Media and specialplay, pause, mute, fn
Punctuationgrave, 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.

TypeCodesValue
mouseButtonleftClick, middleClick, rightClick, leftDoubleClick, middleDoubleClick, rightDoubleClickBoolean; double-click triggers on press
mouseButtonscrollUp, scrollDownLegacy boolean scrolling state
mouseMotionOutmouseMotionOut, mouseLeft, mouseRight, mouseUp, mouseDownBoolean motion state
mouseScrollup, down, left, rightPositive amount, usually 120; immediate action, no release
mousePositionmousePosition{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.

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.