Repository navigation
The 2.0.0 release gets the CLI ready for MAU-based pricing, where Ably bills each distinct client ID that connects from a device. Until now every CLI command connected as a new random client ID, so a single terminal session could look like dozens of users. The CLI now connects as a server, which is not counted as MAU, and acts as one stable client ID that you can see in the "Using:" banner and choose yourself.
This release also changes what ably apps rules create matches, to work the same way as the rules the dashboard creates.
Breaking changes
ably apps rules create "chat"used to create a rule forchatand every channel beneath it, such aschat:room1. It now creates a rule for the channelchatalone. To cover the channels beneath it, useably apps rules create "chat:*". Existing rules are unaffected and keep matching as before.- Long-running commands, such as
subscribeandenter, now exit with a non-zero code when their connection fails, or when it drops five times in a row without staying connected for 10 seconds. Previously they logged a warning and exited with 0, so a script could not tell that it had stopped receiving messages. - When a long-running command reaches
--duration, its--jsonoutput ends with the standard{"type":"status","status":"completed"}line, the same as every other command, instead of a separatecompleteline. - An empty client ID is rejected instead of silently falling back to a random one, and
*is rejected as the CLI's own client ID.--client-id nonestill works but is deprecated and prints a warning.
One client ID per install
- The CLI acts as one client ID for every command, every command in
ably interactive, and every token it issues. It is chosen from the first of--client-id,ABLY_CLIENT_ID,client.idin~/.ably/config, or a default generated once per install and saved in the config. - The "Using:" banner shows the client ID the command acts as.
- To act as another user, for example to demo two users chatting, pass
--client-idin each terminal. - Under token auth, the client ID comes from the token and is never overridden. A JWT without an
x-ably-clientIdclaim is rejected before connecting, with an explanation. ably benchgives each process its own client ID, so many concurrent bench processes do not hit the per-client-ID connection limit.
Server connections
- The CLI is built on
@ably/pubsub-server3.0.0 instead ofably2.x, with@ably/chat2.0.0 and@ably/spaces0.6.0 on the same core. Every Pub/Sub, Chat and Spaces connection the CLI makes is a server connection.
Tokens
ably auth issue-ably-tokenandissue-jwt-tokenalways show who the token is for:Client ID: anonymousin human output andclientId: nullin JSON, rather than leaving the field out.ably auth issue-jwt-token --client-type serverissues a JWT whose holder connects as a server.--client-id "*"still issues wildcard tokens.ably auth revoke-tokenuses the endpoint you are configured for, instead of always callingrest.ably.io, and reports a failure for each target separately.
Channel rules
ably apps rules createcreates rules whose ID is a match expression, with the same syntax as a capability resource:chat:*,*:presenceorfoo:*:baz.ably apps rules create,updateandlistshow each rule's mode,matcherornamespace, since the same ID matches different channels in each.updatekeeps the mode a rule was created with.