Channels presence enter

Open in

Use the ably channels presence enter command to enter presence on a channel and remain present until terminated.

Synopsis

ably channels presence enter <channel-name> [options]

Arguments

channel-name
Required

The name of the channel to enter presence on.

Options

--data

JSON data to associate with the presence member.

--show-others

Display presence events from other members on the channel. Defaults to false.

--sequence-numbers

Display sequence numbers for presence events. Defaults to false.

--duration | -D

The duration in seconds to remain present before automatically leaving.

--client-id

A client ID to use when entering presence.

--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

Enter presence on a channel:

ably channels presence enter my-channel

Enter presence with data:

ably channels presence enter my-channel --data '{"status": "online"}'

Enter presence and show other members' events:

ably channels presence enter my-channel --show-others

Enter presence with a specific client ID:

ably channels presence enter my-channel --client-id "client123"

Enter presence with a client ID and status data:

ably channels presence enter my-channel --client-id "client123" --data '{"name":"John","status":"online"}'

Enter presence for a specific duration:

ably channels presence enter my-channel --duration 30

Enter presence and output events in JSON format:

ably channels presence enter my-channel --json

Enter presence and output events in formatted JSON:

ably channels presence enter my-channel --pretty-json

See also

  • Channels — Explore all ably channels commands.
  • CLI reference — Full list of available commands.