Spaces cursors set

Open in

Use the ably spaces cursors set command to set a cursor with position data in a space.

Synopsis

ably spaces cursors set <space-name> [options]

Arguments

space-name
Required

The name of the space to set the cursor in.

Options

--x

The x coordinate of the cursor position.

--y

The y coordinate of the cursor position.

--data

JSON cursor data to associate with the cursor.

--simulate

Simulate random cursor movement. Defaults to false.

--duration | -D

The duration in seconds to maintain the cursor before automatically removing it.

--client-id

A client ID to use when setting the cursor.

--json

Output results as compact JSON. Mutually exclusive with --pretty-json.

--pretty-json

Output results in formatted JSON. Mutually exclusive with --json.

--verbose | -v

Enable verbose logging. Can be combined with --json or --pretty-json.

Examples

Set a cursor position:

ably spaces cursors set my-space --x 100 --y 200

Set a cursor with additional data:

ably spaces cursors set my-space --x 100 --y 200 --data '{"color": "red"}'

Simulate random cursor movement:

ably spaces cursors set my-space --simulate --duration 30

Simulate cursor movement starting from specific coordinates:

ably spaces cursors set my-space --simulate --x 500 --y 500

Set a cursor position using a data payload:

ably spaces cursors set my-space --data '{"position": {"x": 100, "y": 200}}'

Set a cursor position with user profile data:

ably spaces cursors set my-space --data '{"position": {"x": 100, "y": 200}, "data": {"name": "John", "color": "#ff0000"}}'

Set a cursor position using an API key environment variable:

ABLY_API_KEY="YOUR_API_KEY" ably spaces cursors set my-space --x 100 --y 200

Set a cursor position and output in JSON format:

ably spaces cursors set my-space --x 100 --y 200 --json

Set a cursor position and output in formatted JSON:

ably spaces cursors set my-space --x 100 --y 200 --pretty-json

See also

  • Spaces — Explore all ably spaces commands.
  • CLI reference — Full list of available commands.