From 88bf0326c1901736e63ba70f5f82a2d063ca287a Mon Sep 17 00:00:00 2001 From: sxyazi Date: Tue, 2 Apr 2024 21:39:47 +0800 Subject: [PATCH] docs: clarify the receiver field in DDS and utils plugin --- docs/dds.md | 2 +- docs/plugins/utils.md | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/dds.md b/docs/dds.md index e477e4dc..95ed017c 100644 --- a/docs/dds.md +++ b/docs/dds.md @@ -52,7 +52,7 @@ One payload per line, each payload contains the following fields separated by co | Field | Description | | -------- | --------------------------------------------------------------------------------------------------------------- | | kind | The kind of this message | -| receiver | The instance ID that receives this message; if it's `0`, broadcasts to all instances | +| receiver | The remote instance ID that receives this message; if it's `0`, broadcasts to all remote instances | | severity | The severity of this message; if it's non-zero, indicates a [static message](/docs/plugins/utils#ps.pub_static) | | sender | The sender ID of this message | | body | The body of this message, which is a JSON string | diff --git a/docs/plugins/utils.md b/docs/plugins/utils.md index b0405a1a..ad3be84b 100644 --- a/docs/plugins/utils.md +++ b/docs/plugins/utils.md @@ -331,14 +331,14 @@ Since the `kind` is used globally, to add the plugin name as the prefix is a bes ps.pub_to(1711957283332834, "greeting", "Hello, World!") ``` -Publish a message to a specific instance with `receiver` as the identifier: +Publish a message to a specific instance with `receiver` as the ID: - If the receiver is the current instance (local), and is subscribed to this `kind` through `sub()`, it will receive this message. - If the receiver is not the current instance (remote), and is subscribed to this `kind` through `sub_remote()`, it will receive this message. With: -- `receiver` - Required, the identifier of the receiver, which is a integer; if it's `0` then broadcasting to all instances +- `receiver` - Required, ID of the remote instance, which is a integer; if it's `0` then broadcasting to all remote instances - `kind` - The same as `pub()` - `value` - The same as `pub()` @@ -348,7 +348,7 @@ With: ps.pub_static(10, "greeting", "Hello, World!") ``` -Broadcast a static message to all instances subscribed to this `kind` through `sub_remote()`: +Broadcast a static message to all remote instances subscribed to this `kind` through `sub_remote()`: - `severity` - Required, the severity of the message, which is an integer with a range of 1 to 255 - `kind` - The same as `pub()` @@ -356,7 +356,7 @@ Broadcast a static message to all instances subscribed to this `kind` through `s The message will be stored as static data to achieve state persistence, and when a new instance is created, it will receive all static messages broadcasted by `sub_remote()` before in descending order of `severity` to restore its state from the data. -If you simply want to broadcast a message to all instances without the need for the message to be persisted, use `ps.pub_to()` with receiver `0` instead. +If you simply want to broadcast a message to all remote instances, without the need for the message to be persisted, use `ps.pub_to()` with receiver `0` instead. ### `sub(kind, callback)` {#ps.sub}