# CLI: Realtime and messaging
Source: https://sovaria.in/docs/cli-realtime

Turn live change events for tables on and off, publish to channels, see presence, replay messages and manage end-to-end encryption keys, and send push and email to app users (templates, audiences, sends) with sov.

## sov realtime

Realtime streams and encrypted-channel keys

### sov realtime subscribe
`sov realtime subscribe [OPTIONS] CHANNEL CLIENT_ID`
Subscribe a client to a channel.

### sov realtime unsubscribe
`sov realtime unsubscribe [OPTIONS] CHANNEL CLIENT_ID`
Unsubscribe a client from a channel.

### sov realtime presence
`sov realtime presence [OPTIONS] CHANNEL`
Show online clients for a channel.

### sov realtime channels
`sov realtime channels [OPTIONS]`
List active channels in current scope.

### sov realtime replay
`sov realtime replay [OPTIONS] CHANNEL`
Replay channel events from a sequence index.

### sov realtime publish
`sov realtime publish [OPTIONS] CHANNEL PAYLOAD`
Publish a payload on a channel.

### sov realtime dry-run
`sov realtime dry-run [OPTIONS] CHANNEL`
Would this app caller be allowed to subscribe/publish?
Checks the channel rules; sends nothing.

### sov realtime changes
`sov realtime changes [OPTIONS] [ACTION] [TABLES]`
List tables with live change events, or turn them on/off.
sov realtime changes                       tables whose inserts/updates/deletes are announced sov realtime changes on orders customers   announce changes on db.table.orders, db.table.customers sov realtime changes off orders            stop announcing orders

Events say only THAT rows changed; clients re-read through the table's rules. Listeners also need a read rule naming the table or a SUBSCRIBE rule on db.table.<table> (check with `sov realtime dry-run`). On a branch the setting is saved with the branch and takes effect on production after deploy.

### sov realtime e2ee-bootstrap
`sov realtime e2ee-bootstrap [OPTIONS] CHANNEL`
Create or fetch the active channel encryption key (Sovaria-managed).

### sov realtime e2ee-rotate
`sov realtime e2ee-rotate [OPTIONS] CHANNEL`
Rotate a channel encryption key.

### sov realtime e2ee-revoke
`sov realtime e2ee-revoke [OPTIONS] CHANNEL`
Revoke a channel encryption key.

### sov realtime e2ee-list
`sov realtime e2ee-list [OPTIONS] [CHANNEL]`
List a channel's encryption keys.

### sov realtime ws-url
`sov realtime ws-url [OPTIONS] [CHANNEL]`
Generate the realtime WebSocket URL for a channel.

## sov messaging

Push and email to app users: templates, audiences, sends

### sov messaging templates
`sov messaging templates [OPTIONS]`
List message templates.

### sov messaging template-save
`sov messaging template-save [OPTIONS] NAME`
Create or replace a template; use {{ variables }} in any text.

### sov messaging template-delete
`sov messaging template-delete [OPTIONS] NAME`
Delete a template.

### sov messaging audiences
`sov messaging audiences [OPTIONS]`
List saved audiences.

### sov messaging audience-save
`sov messaging audience-save [OPTIONS] NAME`
Create or replace an audience.

### sov messaging audience-preview
`sov messaging audience-preview [OPTIONS] [NAME]`
How many app users an audience reaches, its columns and a sample (read-only).

### sov messaging send
`sov messaging send [OPTIONS]`
Send a template to app users, now or at --at (a durable job sends it; check with `sov messaging status`, stop it with `sov messaging cancel`).

### sov messaging cancel
`sov messaging cancel [OPTIONS] SEND_ID`
Cancel a scheduled or running send (recipients not reached yet get nothing).

### sov messaging sends
`sov messaging sends [OPTIONS]`
Recent sends with their status and counts.

### sov messaging status
`sov messaging status [OPTIONS] SEND_ID`
A send's status and counts per channel.

### sov messaging deliveries
`sov messaging deliveries [OPTIONS]`
The delivery log (status and error code per recipient and channel; never content).

### sov messaging in-app
`sov messaging in-app [OPTIONS]`
In-app messages with users reached, impressions, clicks and dismissals.

### sov messaging in-app-save
`sov messaging in-app-save [OPTIONS] NAME`
Create or replace an in-app message (your app shows it with sov.inApp.fetch(trigger)).

### sov messaging in-app-delete
`sov messaging in-app-delete [OPTIONS] NAME`
Delete an in-app message.

## sov push

Push notifications: providers, web push keys, sends

### sov push setup
`sov push setup [OPTIONS]`
Which providers are configured (FCM project, APNs key id, web push public key).

### sov push webpush-keys
`sov push webpush-keys [OPTIONS]`
Create (or rotate) the project's VAPID keys for browser push; prints the public key.

### sov push send
`sov push send [OPTIONS]`
Send a push to a topic or users.
Large sends are queued and paced at your plan's rate.

### sov push sends
`sov push sends [OPTIONS]`
Recent sends (status, counts, error codes) and this month's total.

### sov push cancel
`sov push cancel [OPTIONS] SEND_ID`
Cancel a queued or running large send.
