From ef137d3fe0f2cab2caebe33a6bcc8130d64321d0 Mon Sep 17 00:00:00 2001 From: Vladimir Dementyev Date: Mon, 1 Apr 2024 15:06:29 -0700 Subject: [PATCH] release notes: add Rails whispering --- docs/misc/action_cable_protocol.md | 26 +++++++++++++++++++++++++- docs/release_notes.md | 6 ++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/docs/misc/action_cable_protocol.md b/docs/misc/action_cable_protocol.md index 9c20f71..4187def 100644 --- a/docs/misc/action_cable_protocol.md +++ b/docs/misc/action_cable_protocol.md @@ -227,6 +227,30 @@ The `restored` flag indicates whether the session state has been restored. **NOT The optional `restored_ids` field contains the list of channel identifiers that has been re-subscribed automatically at the server side. The client MUST NOT try to resubscribe to the specified channels and consider them connected. It's recommended to perform `history` requests for all the restored channels to catch up with the messages. -### New command: `pong` new +### New command: `pong` The `pong` command MAY be sent in response to the `ping` message if the server requires pongs. It could be used to improve broken connections detection. + +### New command: `whisper` new + +The `whisper` can be used to publish broadcast messages from the client (if the whisper stream has been configured for it) to a particular _channel_. + +The payload MUST contain `command` ("whisper"), `identifier` fields, and `data` fields. + +The `data` field MAY contain a string or an object. + +For example: + +```json +{ + "identifier": "{\"channel\":\"ChatChannel\",\"id\":42}", + "command": "whisper", + "data": { + "event":"typing", + "user":"Jack" + } +} +``` + +**IMPORTANT**: Unlike actions (`message` command), the data is not JSON-serialized. It's broadcasted to connected clients as is. + diff --git a/docs/release_notes.md b/docs/release_notes.md index 443e1eb..197fe07 100644 --- a/docs/release_notes.md +++ b/docs/release_notes.md @@ -46,6 +46,12 @@ This page contains combined release notes for major and minor releases of all An See [docs](/rails/extensions?id=broadcast-to-objects). +- Whispering support. + + You can specify the whispering stream (for client-initiated broadcasts) by using the `#stream_from(..., whisper: true)` or `#stream_for(..., whisper: true)` in your channel classes. + + See [docs](/rails/extensions?id=whispering). + - Added `rails g anycable:bin`. This generator creates a `bin/anycable-go` script to run (and install) AnyCable server locally.