@wix/realtime 1.0.42 → 1.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
3
3
  /**
4
4
  * Publishes a message to a channel or resource.
5
5
  *
6
- * The method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages published to a resource. Similarly, subscribers to a resource don't receive messages published to the parent channel.
6
+ * The method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages sent to a resource on that channel. Similarly, subscribers to a resource don't receive messages sent to its parent channel.
7
7
  *
8
8
  * > **Authentication**
9
9
  * >
@@ -35,9 +35,11 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
35
35
  * await client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });
36
36
  * ```
37
37
  *
38
- * @param channel - Channel and optionally resource to publish to.
38
+ * @param channel - Channel and resource to publish to.
39
39
  * @requiredField channel
40
40
  * @param payload - Message payload. Max: 10 KB.
41
41
  * @requiredField payload
42
+ * @permissionId realtime:v4:message:publish
43
+ * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish
42
44
  */
43
45
  export declare const publish: MaybeContext<BuildRESTFunction<typeof publicPublish> & typeof publicPublish>;
@@ -6,7 +6,7 @@ const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
6
6
  /**
7
7
  * Publishes a message to a channel or resource.
8
8
  *
9
- * The method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages published to a resource. Similarly, subscribers to a resource don't receive messages published to the parent channel.
9
+ * The method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages sent to a resource on that channel. Similarly, subscribers to a resource don't receive messages sent to its parent channel.
10
10
  *
11
11
  * > **Authentication**
12
12
  * >
@@ -38,9 +38,11 @@ const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
38
38
  * await client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });
39
39
  * ```
40
40
  *
41
- * @param channel - Channel and optionally resource to publish to.
41
+ * @param channel - Channel and resource to publish to.
42
42
  * @requiredField channel
43
43
  * @param payload - Message payload. Max: 10 KB.
44
44
  * @requiredField payload
45
+ * @permissionId realtime:v4:message:publish
46
+ * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish
45
47
  */
46
48
  exports.publish = (0, rest_modules_1.createRESTModule)(publisher_public_js_1.publish);
@@ -3,10 +3,12 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
3
3
  /**
4
4
  * Subscribes to a channel or resource.
5
5
  *
6
- * The method attempts to establish a subscription to the specified channel or resource. While the subscription is attempted asynchronously, the method returns the subscription ID immediately.
6
+ * The method attempts to establish a subscription to the specified channel or resource. It returns the subscription ID immediately while the subscription is attempted in the background.
7
7
  *
8
8
  * Use the `options` parameter to register handlers that run whenever the subscription succeeds or generates an error. For some errors, the subscription is re-attempted automatically. The `onSubscribed()` handler runs on every successful re-subscription.
9
9
  *
10
+ * Learn more about the [subscription lifecycle](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_subscription-lifecycle).
11
+ *
10
12
  * @example Subscribe to a channel
11
13
  * ```ts
12
14
  * import { subscriber } from '@wix/realtime';
@@ -44,11 +46,11 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
44
46
  * );
45
47
  * ```
46
48
  *
47
- * @param channel - Channel, and optionally resource, to subscribe to.
49
+ * @param channel - Channel and resource to subscribe to.
48
50
  * @requiredField channel
49
- * @param messageHandler - Callback that runs whenever a message is published to the channel.
51
+ * @param messageHandler - Handler that runs whenever a message is published to the channel or resource.
50
52
  * @requiredField messageHandler
51
- * @param options - Lifecycle handlers for subscription events.
53
+ * @param options - [Lifecycle handlers](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_subscription-lifecycle) for subscription events.
52
54
  */
53
55
  export declare const subscribe: MaybeContext<BuildRESTFunction<typeof publicSubscribe> & typeof publicSubscribe>;
54
56
  /**
@@ -89,7 +91,7 @@ export declare const subscribe: MaybeContext<BuildRESTFunction<typeof publicSubs
89
91
  * client.subscriber.unsubscribe({ channel: { name: 'my-channel' } });
90
92
  * ```
91
93
  *
92
- * @param options - Unsubscribe information. You must specify `channel`, `subscriptionId`, or both.
94
+ * @param options - Unsubscribe details. You must specify `channel`, `subscriptionId`, or both.
93
95
  * @requiredField options
94
96
  */
95
97
  export declare const unsubscribe: MaybeContext<BuildRESTFunction<typeof publicUnsubscribe> & typeof publicUnsubscribe>;
@@ -6,10 +6,12 @@ const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
6
6
  /**
7
7
  * Subscribes to a channel or resource.
8
8
  *
9
- * The method attempts to establish a subscription to the specified channel or resource. While the subscription is attempted asynchronously, the method returns the subscription ID immediately.
9
+ * The method attempts to establish a subscription to the specified channel or resource. It returns the subscription ID immediately while the subscription is attempted in the background.
10
10
  *
11
11
  * Use the `options` parameter to register handlers that run whenever the subscription succeeds or generates an error. For some errors, the subscription is re-attempted automatically. The `onSubscribed()` handler runs on every successful re-subscription.
12
12
  *
13
+ * Learn more about the [subscription lifecycle](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_subscription-lifecycle).
14
+ *
13
15
  * @example Subscribe to a channel
14
16
  * ```ts
15
17
  * import { subscriber } from '@wix/realtime';
@@ -47,11 +49,11 @@ const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
47
49
  * );
48
50
  * ```
49
51
  *
50
- * @param channel - Channel, and optionally resource, to subscribe to.
52
+ * @param channel - Channel and resource to subscribe to.
51
53
  * @requiredField channel
52
- * @param messageHandler - Callback that runs whenever a message is published to the channel.
54
+ * @param messageHandler - Handler that runs whenever a message is published to the channel or resource.
53
55
  * @requiredField messageHandler
54
- * @param options - Lifecycle handlers for subscription events.
56
+ * @param options - [Lifecycle handlers](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_subscription-lifecycle) for subscription events.
55
57
  */
56
58
  exports.subscribe = (0, rest_modules_1.createRESTModule)(subscriber_public_js_1.subscribe);
57
59
  /**
@@ -92,7 +94,7 @@ exports.subscribe = (0, rest_modules_1.createRESTModule)(subscriber_public_js_1.
92
94
  * client.subscriber.unsubscribe({ channel: { name: 'my-channel' } });
93
95
  * ```
94
96
  *
95
- * @param options - Unsubscribe information. You must specify `channel`, `subscriptionId`, or both.
97
+ * @param options - Unsubscribe details. You must specify `channel`, `subscriptionId`, or both.
96
98
  * @requiredField options
97
99
  */
98
100
  exports.unsubscribe = (0, rest_modules_1.createRESTModule)(subscriber_public_js_1.unsubscribe);
@@ -38,7 +38,7 @@
38
38
  "summary": [
39
39
  {
40
40
  "kind": "text",
41
- "text": "Publishes a message to a channel or resource.\n\nThe method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages published to a resource. Similarly, subscribers to a resource don't receive messages published to the parent channel.\n\n> **Authentication**\n>\n> This method may require higher-level permissions than the caller has, based on their [identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities) and [roles and permissions](https://support.wix.com/en/article/roles-permissions-overview). In these cases, you can ensure the method is called with the required level of authorization by using [elevated permissions](https://dev.wix.com/docs/api-reference/articles/authentication/about-elevated-permissions).\n\n<!-- TODO: Check whether this API is relevant for headless projects. -->"
41
+ "text": "Publishes a message to a channel or resource.\n\nThe method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages sent to a resource on that channel. Similarly, subscribers to a resource don't receive messages sent to its parent channel.\n\n> **Authentication**\n>\n> This method may require higher-level permissions than the caller has, based on their [identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities) and [roles and permissions](https://support.wix.com/en/article/roles-permissions-overview). In these cases, you can ensure the method is called with the required level of authorization by using [elevated permissions](https://dev.wix.com/docs/api-reference/articles/authentication/about-elevated-permissions).\n\n<!-- TODO: Check whether this API is relevant for headless projects. -->"
42
42
  }
43
43
  ],
44
44
  "blockTags": [
@@ -85,6 +85,24 @@
85
85
  "text": "payload"
86
86
  }
87
87
  ]
88
+ },
89
+ {
90
+ "tag": "@permissionId",
91
+ "content": [
92
+ {
93
+ "kind": "text",
94
+ "text": "realtime:v4:message:publish"
95
+ }
96
+ ]
97
+ },
98
+ {
99
+ "tag": "@fqn",
100
+ "content": [
101
+ {
102
+ "kind": "text",
103
+ "text": "com.wix.realtime.v4.DuplexerApiV4.Publish"
104
+ }
105
+ ]
88
106
  }
89
107
  ]
90
108
  },
@@ -99,7 +117,7 @@
99
117
  "summary": [
100
118
  {
101
119
  "kind": "text",
102
- "text": "Channel and optionally resource to publish to."
120
+ "text": "Channel and resource to publish to."
103
121
  }
104
122
  ]
105
123
  },
@@ -171,7 +189,7 @@
171
189
  "summary": [
172
190
  {
173
191
  "kind": "text",
174
- "text": "Publishes a message to a channel or resource.\n\nThe method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages published to a resource. Similarly, subscribers to a resource don't receive messages published to the parent channel.\n\n> **Authentication**\n>\n> This method may require higher-level permissions than the caller has, based on their [identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities) and [roles and permissions](https://support.wix.com/en/article/roles-permissions-overview). In these cases, you can ensure the method is called with the required level of authorization by using [elevated permissions](https://dev.wix.com/docs/api-reference/articles/authentication/about-elevated-permissions).\n\n<!-- TODO: Check whether this API is relevant for headless projects. -->"
192
+ "text": "Publishes a message to a channel or resource.\n\nThe method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages sent to a resource on that channel. Similarly, subscribers to a resource don't receive messages sent to its parent channel.\n\n> **Authentication**\n>\n> This method may require higher-level permissions than the caller has, based on their [identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities) and [roles and permissions](https://support.wix.com/en/article/roles-permissions-overview). In these cases, you can ensure the method is called with the required level of authorization by using [elevated permissions](https://dev.wix.com/docs/api-reference/articles/authentication/about-elevated-permissions).\n\n<!-- TODO: Check whether this API is relevant for headless projects. -->"
175
193
  }
176
194
  ],
177
195
  "blockTags": [
@@ -218,6 +236,24 @@
218
236
  "text": "payload"
219
237
  }
220
238
  ]
239
+ },
240
+ {
241
+ "tag": "@permissionId",
242
+ "content": [
243
+ {
244
+ "kind": "text",
245
+ "text": "realtime:v4:message:publish"
246
+ }
247
+ ]
248
+ },
249
+ {
250
+ "tag": "@fqn",
251
+ "content": [
252
+ {
253
+ "kind": "text",
254
+ "text": "com.wix.realtime.v4.DuplexerApiV4.Publish"
255
+ }
256
+ ]
221
257
  }
222
258
  ]
223
259
  },
@@ -307,7 +343,7 @@
307
343
  "summary": [
308
344
  {
309
345
  "kind": "text",
310
- "text": "Sets a permissions handler for a specific channel or resource.\n\nAdding a handler to a channel without specifying a resource applies the handler to the channel and to any of its resources that don't have their own handler. Learn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
346
+ "text": "Sets a permissions handler for a specific channel or resource.\n\nAdding a handler to a channel without specifying a resource applies the handler to the channel and to all of its resources that don't have their own handler.\n\nLearn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
311
347
  }
312
348
  ],
313
349
  "blockTags": [
@@ -360,7 +396,7 @@
360
396
  "summary": [
361
397
  {
362
398
  "kind": "text",
363
- "text": "Channel or resource to set a permissions handler for."
399
+ "text": "Channel or resource to add the permissions handler for."
364
400
  }
365
401
  ]
366
402
  },
@@ -381,7 +417,7 @@
381
417
  "summary": [
382
418
  {
383
419
  "kind": "text",
384
- "text": "Handler to run when checking permissions for the specified channel."
420
+ "text": "Handler that runs when checking permissions for the specified channel."
385
421
  }
386
422
  ]
387
423
  },
@@ -437,7 +473,7 @@
437
473
  "summary": [
438
474
  {
439
475
  "kind": "text",
440
- "text": "Checks permissions for a subscriber on a channel or resource.\n\nRuns the appropriate permissions handler to check whether the subscriber can receive messages on the specified channel or resource. Call this method in the body of the ["
476
+ "text": "Checks permissions for a subscriber on a channel or resource.\n\nRuns the associated permissions handler to check whether the subscriber can receive messages on the specified channel or resource. To delegate permissions check to the router, call this method in the body of the ["
441
477
  },
442
478
  {
443
479
  "kind": "code",
@@ -445,7 +481,7 @@
445
481
  },
446
482
  {
447
483
  "kind": "text",
448
- "text": "](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/realtime-check-permission) hook.\n\nLearn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
484
+ "text": "](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/realtime-check-permission) hook."
449
485
  }
450
486
  ],
451
487
  "blockTags": [
@@ -597,7 +633,7 @@
597
633
  "summary": [
598
634
  {
599
635
  "kind": "text",
600
- "text": "Sets the default permissions handler.\n\nThe default handler runs when no explicit handler is set for the channel. For resources, the handler runs when both the resource and its parent channel don't have one. Learn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
636
+ "text": "Sets the default permissions handler.\n\nThe default handler runs in the following cases:\n- When subscribing to a channel, when no explicit handler is set for that channel.\n- When subscribing to a resource, when no explicit handler is set for that resource or its parent channel.\n\nLearn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
601
637
  }
602
638
  ],
603
639
  "blockTags": [
@@ -841,7 +877,7 @@
841
877
  "summary": [
842
878
  {
843
879
  "kind": "text",
844
- "text": "Sets a permissions handler for a specific channel or resource.\n\nAdding a handler to a channel without specifying a resource applies the handler to the channel and to any of its resources that don't have their own handler. Learn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
880
+ "text": "Sets a permissions handler for a specific channel or resource.\n\nAdding a handler to a channel without specifying a resource applies the handler to the channel and to any of its resources that don't have their own handlers. Learn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
845
881
  }
846
882
  ],
847
883
  "blockTags": [
@@ -1111,7 +1147,7 @@
1111
1147
  "summary": [
1112
1148
  {
1113
1149
  "kind": "text",
1114
- "text": "Sets the default permissions handler.\n\nThe default handler runs when no explicit handler is set for the channel. For resources, the handler runs when both the resource and its parent channel don't have one. Learn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
1150
+ "text": "Sets the default permissions handler.\n\nThe default handler runs in the following cases:\n- When subscribing to a channel, when no explicit handler is set for that channel.\n- When subscribing to a resource, when no explicit handler is set for that resource or its parent channel.\n\nLearn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
1115
1151
  }
1116
1152
  ],
1117
1153
  "blockTags": [
@@ -1754,7 +1790,7 @@
1754
1790
  "summary": [
1755
1791
  {
1756
1792
  "kind": "text",
1757
- "text": "Checks permissions for a subscriber on a channel or resource.\n\nThis hook runs automatically whenever a new subscription is attempted, including [re-subscriptions after reconnection](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_reconnection-and-message-sync). Permissions are checked once per subscription attempt. Changes to permissions don't affect active subscriptions until the subscriber reconnects.\n\nSet up this hook as a named export in the "
1793
+ "text": "Checks permissions for a subscriber on a channel or resource.\n\nSet up this hook as a named export in the "
1758
1794
  },
1759
1795
  {
1760
1796
  "kind": "code",
@@ -1762,7 +1798,15 @@
1762
1798
  },
1763
1799
  {
1764
1800
  "kind": "text",
1765
- "text": " file in a site's backend.\n\nCall the [Permissions Router](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction) to organize logic per channel and resource. You can include permissions logic directly in the hook body, but for most use cases, use the permissions router.\n\nLearn more about [setting up permissions](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#setting-up-permissions)."
1801
+ "text": " file in a site's backend. The hook runs automatically whenever a new subscription is attempted, including [re-subscriptions after reconnection](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_reconnection-and-message-sync). Permissions are checked once per subscription attempt. Changes to permissions don't affect active subscriptions until the subscriber reconnects.\n\nCall ["
1802
+ },
1803
+ {
1804
+ "kind": "code",
1805
+ "text": "`check()`"
1806
+ },
1807
+ {
1808
+ "kind": "text",
1809
+ "text": "](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/check) in the body of this hook to use the [Permissions Router](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction) to organize permissions logic. Alternatively, you can also include permissions logic directly in the hook body.\n\nLearn more about [setting up permissions](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#setting-up-permissions)."
1766
1810
  }
1767
1811
  ],
1768
1812
  "blockTags": [
@@ -1942,7 +1986,7 @@
1942
1986
  "summary": [
1943
1987
  {
1944
1988
  "kind": "text",
1945
- "text": "Subscribes to a channel or resource.\n\nThe method attempts to establish a subscription to the specified channel or resource. While the subscription is attempted asynchronously, the method returns the subscription ID immediately.\n\nUse the "
1989
+ "text": "Subscribes to a channel or resource.\n\nThe method attempts to establish a subscription to the specified channel or resource. It returns the subscription ID immediately while the subscription is attempted in the background.\n\nUse the "
1946
1990
  },
1947
1991
  {
1948
1992
  "kind": "code",
@@ -1958,7 +2002,7 @@
1958
2002
  },
1959
2003
  {
1960
2004
  "kind": "text",
1961
- "text": " handler runs on every successful re-subscription."
2005
+ "text": " handler runs on every successful re-subscription.\n\nLearn more about the [subscription lifecycle](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_subscription-lifecycle)."
1962
2006
  }
1963
2007
  ],
1964
2008
  "blockTags": [
@@ -2019,7 +2063,7 @@
2019
2063
  "summary": [
2020
2064
  {
2021
2065
  "kind": "text",
2022
- "text": "Channel, and optionally resource, to subscribe to."
2066
+ "text": "Channel and resource to subscribe to."
2023
2067
  }
2024
2068
  ]
2025
2069
  },
@@ -2040,7 +2084,7 @@
2040
2084
  "summary": [
2041
2085
  {
2042
2086
  "kind": "text",
2043
- "text": "Callback that runs whenever a message is published to the channel."
2087
+ "text": "Handler that runs whenever a message is published to the channel or resource."
2044
2088
  }
2045
2089
  ]
2046
2090
  },
@@ -2063,7 +2107,7 @@
2063
2107
  "summary": [
2064
2108
  {
2065
2109
  "kind": "text",
2066
- "text": "Lifecycle handlers for subscription events."
2110
+ "text": "[Lifecycle handlers](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_subscription-lifecycle) for subscription events."
2067
2111
  }
2068
2112
  ]
2069
2113
  },
@@ -2090,7 +2134,7 @@
2090
2134
  "summary": [
2091
2135
  {
2092
2136
  "kind": "text",
2093
- "text": "Subscribes to a channel or resource.\n\nThe method attempts to establish a subscription to the specified channel or resource. While the subscription is attempted asynchronously, the method returns the subscription ID immediately.\n\nUse the "
2137
+ "text": "Subscribes to a channel or resource.\n\nThe method attempts to establish a subscription to the specified channel or resource. It returns the subscription ID immediately while the subscription is attempted in the background.\n\nUse the "
2094
2138
  },
2095
2139
  {
2096
2140
  "kind": "code",
@@ -2106,7 +2150,7 @@
2106
2150
  },
2107
2151
  {
2108
2152
  "kind": "text",
2109
- "text": " handler runs on every successful re-subscription."
2153
+ "text": " handler runs on every successful re-subscription.\n\nLearn more about the [subscription lifecycle](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_subscription-lifecycle)."
2110
2154
  }
2111
2155
  ],
2112
2156
  "blockTags": [
@@ -2271,7 +2315,7 @@
2271
2315
  "summary": [
2272
2316
  {
2273
2317
  "kind": "text",
2274
- "text": "Unsubscribe information. You must specify "
2318
+ "text": "Unsubscribe details. You must specify "
2275
2319
  },
2276
2320
  {
2277
2321
  "kind": "code",
@@ -3584,7 +3628,7 @@
3584
3628
  {
3585
3629
  "type": "GUIDE",
3586
3630
  "title": "Introduction",
3587
- "src": "---\narticleType: intro\n---\n\n# About the Publisher API\n\nThe Publisher API is a backend module for sending messages to [channels and resources](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction#channels-and-channel-resources). Subscribers with suitable permissions receive these messages instantly. Channels and resources are independent, so messages sent to a channel aren't delivered to a resource, and vice versa.\n\nLearn more [about the Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction).\n\n<!-- TODO check that elevation note appears in method description -->\n<!-- TODO: Check whether this API is relevant for headless projects. -->\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- Messages don't persist across tab sessions. Closing the browser tab or window closes the connection.\n- Messages aren't queued. When no subscribers are listening, the message is dropped.\n\n<!-- ## Use cases\n\n- [Send notifications to connected clients](ADDLINK).\n- [Broadcast data updates in real time](ADDLINK).\n- [Push state changes to a live dashboard](ADDLINK). -->\n\n## See also\n\n- [Subscriber API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction)\n- [Site API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/introduction)\n- [Permissions Router API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction)\n\n@sdk_package_setup\n"
3631
+ "src": "---\narticleType: intro\n---\n\n# About the Publisher API\n\nThe Publisher API is a backend module for sending messages to [channels and resources](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction#channels-and-channel-resources). Subscribers with suitable permissions receive these messages instantly. Channels and resources are independent, so messages sent to a channel aren't delivered to a resource, and vice versa.\n\nLearn more [about the Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction).\n\nWith the Publisher API, you can:\n\n- Publish messages to a channel or resource.\n\n<!-- TODO check that elevation note appears in method description -->\n<!-- TODO: Check whether this API is relevant for headless projects. -->\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- Messages don't persist across tab sessions. Closing the browser tab or window closes the connection.\n- Messages aren't queued. When no subscribers are listening, the message is dropped.\n\n<!-- ## Use cases\n\n- [Send notifications to connected clients](ADDLINK).\n- [Broadcast data updates in real time](ADDLINK).\n- [Push state changes to a live dashboard](ADDLINK). -->\n\n## See also\n\n- [Subscriber API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction)\n- [Site API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/introduction)\n- [Permissions Router API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction)\n\n@sdk_package_setup\n"
3588
3632
  },
3589
3633
  {
3590
3634
  "type": "GUIDE",
@@ -3596,7 +3640,7 @@
3596
3640
  {
3597
3641
  "type": "GUIDE",
3598
3642
  "title": "Introduction",
3599
- "src": "---\narticleType: intro\n---\n\n# About the Subscriber API\n\nThe Subscriber API lets clients subscribe to [channels and resources](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction#channels-and-channel-resources). When a publisher sends messages, subscribers with suitable permissions receive them in real time. Channels and resources are independent, so messages sent to a channel aren't published to a resource, and vice versa.\n\nLearn more [about the Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction).\n\nWith the Subscriber API, you can:\n\n- Subscribe or unsubscribe from a channel or resource.\n- Respond to subscription successes, connection errors, and incoming messages with dedicated handlers.\n\n## Subscription lifecycle\n\nThe `subscribe()` method returns a subscription ID immediately, but the connection is established in the background. Subscribers can use the subscription ID to [unsubscribe](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/unsubscribe) at a later time.\n\nYou can register lifecycle handlers to respond when the subscription succeeds or fails. The [`onSubscribed` handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) runs on every successful connection, including automatic re-subscriptions attempted after network interruptions. The [`onSubscriptionError` handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) runs whenever an error occurs.\n\n### Unsubscribing\n\nYou can unsubscribe in the following ways:\n\n- By `subscriptionId`: Removes a single subscription.\n<!-- TODO: Confirm with dev that unsubscribing by channel doesn't affect resource subscriptions, and vice versa. Item 2.13-->\n- By `channel`: Removes all subscriptions that match the specified channel and resource exactly. Unsubscribing from a channel doesn't affect subscriptions to resources on that channel, and vice versa.\n- By both: Removes the specific subscription, verifying it matches the specified channel or resource. If it doesn't, the subscription isn't removed.\n\nWhen the last subscription on a connection is removed, the connection closes automatically.\n\n## Reconnection and message sync\n\nIf the connection drops, the client automatically attempts to reconnect and re-subscribe. When subscribing or re-subscribing, the `isSynced` parameter of the `onSubscribed()` handler indicates whether all missed messages were successfully restored, or whether the subscriber needs to take further action.\n\nLearn more about [subscribing](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) to a channel or resource.\n\n<!-- TODO: Document backend buffer limits for message replay. -->\n\n## Subscription errors\n\nSubscription errors occur when a subscription is rejected or when the connection fails. Each error includes `errorCode` and `recoverable` properties that indicate the error type and whether the client is automatically retrying.\n\nLearn more about how the [`subscribe()`](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) method handles subscription errors.\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- Subscriptions don't persist across sessions.\n- Closing a browser tab removes all its subscriptions.\n- The Realtime SDK checks permissions when a subscription is first established. When a subscriber doesn't have `read` permission on the channel, the subscription fails.\n<!-- TODO: Document channel/subscription limits per site/app. -->\n\n<!-- ## Use cases\n\n- [Send notifications to connected clients](ADDLINK).\n- [Broadcast data updates in real time](ADDLINK).\n- [Push state changes to a live dashboard](ADDLINK). -->\n\n## See also\n\n- [Publisher API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/publisher/introduction)\n- [Site API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/introduction)\n- [Permissions Router API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction)\n\n@sdk_package_setup\n"
3643
+ "src": "---\narticleType: intro\n---\n\n# About the Subscriber API\n\nThe Subscriber API lets clients subscribe to [channels and resources](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction#channels-and-channel-resources) to receive messages in real time. Subscribers with suitable permissions instantly receive messages sent by a publisher. Channels and resources are independent, so messages sent to a channel aren't delivered to a resource, and vice versa.\n\nLearn more [about the Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction).\n\nWith the Subscriber API, you can:\n\n- Subscribe or unsubscribe from a channel or resource.\n- Respond to subscription successes, connection errors, and incoming messages with dedicated handlers.\n\n## Subscription lifecycle\n\nThe `subscribe()` method returns a subscription ID immediately, but the connection is established in the background. Subscribers can use the subscription ID to [unsubscribe](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/unsubscribe) at a later time.\n\nYou can register lifecycle handlers to respond when the subscription succeeds or fails:\n\n- The [`onSubscribed` handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) runs on every successful connection, including [automatic re-connections](#reconnection-and-message-sync) attempted after network interruptions.\n- The [`onSubscriptionError` handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) runs whenever an [error occurs](#subscription-errors).\n\n### Reconnection and message sync\n\nIf the connection drops, the client automatically attempts to reconnect and re-subscribe. When subscribing or re-subscribing, the `isSynced` parameter of the `onSubscribed()` handler indicates whether all missed messages were successfully restored, or whether the subscriber needs to take further action.\n\nLearn more about [subscribing](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) to a channel or resource.\n\n<!-- TODO: Document backend buffer limits for message replay. -->\n\n### Subscription errors\n\nSubscription errors occur when a subscription is rejected or when the connection fails. Each error includes `errorCode` and `recoverable` parameters that indicate the error type and whether the client is automatically trying to reconnect.\n\nLearn more about how the [`subscribe()`](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) method handles subscription errors.\n\n## Unsubscribing\n\nYou can unsubscribe in the following ways:\n\n- By `subscriptionId`: Removes a single subscription.\n<!-- TODO: Confirm with dev that unsubscribing by channel doesn't affect resource subscriptions, and vice versa. Item 2.13-->\n- By `channel`: Removes all subscriptions that match the specified channel and resource exactly. Unsubscribing from a channel doesn't affect subscriptions to resources on that channel, and vice versa.\n- By both: Removes the specific subscription, verifying it matches the specified channel or resource. If it doesn't, the subscription isn't removed.\n\nWhen the last subscription on a connection is removed, the connection closes automatically.\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- The Realtime SDK checks permissions when a subscription is first established. When a subscriber doesn't have `read` permission on the channel, the subscription fails.\n- Subscriptions don't persist across sessions. Closing a browser tab removes all its subscriptions.\n<!-- TODO: Document channel/subscription limits per site/app. -->\n\n<!-- ## Use cases\n\n- [Send notifications to connected clients](ADDLINK).\n- [Broadcast data updates in real time](ADDLINK).\n- [Push state changes to a live dashboard](ADDLINK). -->\n\n## See also\n\n- [Publisher API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/publisher/introduction)\n- [Site API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/introduction)\n- [Permissions Router API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction)\n\n@sdk_package_setup\n"
3600
3644
  },
3601
3645
  {
3602
3646
  "type": "GUIDE",
@@ -3608,7 +3652,7 @@
3608
3652
  {
3609
3653
  "type": "GUIDE",
3610
3654
  "title": "Introduction",
3611
- "src": "---\narticleType: intro\n---\n\n# About the Site API\n\nThe Site API lets you control subscriber permissions for the [Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction). It determines which [subscribers](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction) can receive messages on specific [channels and resources](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction#channels-and-channel-resources).\n\nWith the Site API, you can:\n\n- Define the [`realtime_check_permission` hook](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/realtime-check-permission) in the `realtime-permissions.js` file in a site's backend to control subscriber access.\n- Use the [permissions router](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction) to organize permission logic per channel or resource.\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- In Wix Studio, you must create a `realtime-permissions.js` file in a site's backend, even if `realtime_check_permission` isn't defined. Without the file, subscriptions fail.\n- When the `realtime_check_permission` hook isn't defined, all subscribers receive the default permissions of `{\"read\": true}`.\n- When previewing a site, `read` permissions are always `true`.\n\n## Use cases\n\nRestrict a channel so only the site owner can receive messages. Use the [permissions router](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction) to add a handler that checks `subscriber.type`:\n\n```js\nimport { site } from \"@wix/realtime\";\nconst { permissionsRouter } = site;\n\npermissionsRouter.add({ name: \"owner-only\" }, (channel, subscriber) => {\n return { read: subscriber.type === \"USER\" };\n});\n\nexport function realtime_check_permission(channel, subscriber) {\n return permissionsRouter.check(channel, subscriber);\n}\n```\n\n## See also\n\n- [Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction)\n- [Permissions Router API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction)\n- [Subscriber API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction)\n- [Publisher API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/publisher/introduction)\n\n@sdk_package_setup\n"
3655
+ "src": "---\narticleType: intro\n---\n\n# About the Site API\n\nThe Site API lets you control subscriber permissions for the [Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction). It determines which [subscribers](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction) can receive messages on specific [channels and resources](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction#channels-and-channel-resources).\n\nWith the Site API, you can:\n\n- Use the [permissions router](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction) to organize permission logic per channel or resource.\n- Control subscriber access using the [`realtime_check_permission` hook](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/realtime-check-permission).\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- In Wix Studio, you must create a `realtime-permissions.js` file in a site's backend, even if `realtime_check_permission` isn't defined. Without the file, subscriptions fail.\n- When the `realtime_check_permission` hook isn't defined, all subscribers receive the default permissions of `{\"read\": true}`.\n- When previewing a site, `read` permissions are always `true`.\n\n## Use cases\n\nRestrict a channel so only the Wix user can receive messages. Use the [permissions router](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction) to add a handler that checks `subscriber.type`:\n\n```js\nimport { site } from \"@wix/realtime\";\nconst { permissionsRouter } = site;\n\npermissionsRouter.add({ name: \"owner-only\" }, (channel, subscriber) => {\n return { read: subscriber.type === \"USER\" };\n});\n\nexport function realtime_check_permission(channel, subscriber) {\n return permissionsRouter.check(channel, subscriber);\n}\n```\n\n## See also\n\n- [Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction)\n- [Permissions Router API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction)\n- [Subscriber API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction)\n- [Publisher API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/publisher/introduction)\n\n@sdk_package_setup\n"
3612
3656
  },
3613
3657
  {
3614
3658
  "type": "GUIDE",
@@ -3671,14 +3715,14 @@
3671
3715
  {
3672
3716
  "type": "GUIDE",
3673
3717
  "title": "Introduction",
3674
- "src": "---\narticleType: intro\n---\n\n# About the Permissions Router API\n\nThe Permissions Router API is a utility for organizing channel permission logic. The router lets you set up a default permissions handler as well as handlers specific to channels or resources.\n\n> **Note:** Alternatively, you can include permissions logic directly in the [`realtime_check_permission()` hook](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/realtime-check-permission).\n\nLearn more about the [Site API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/introduction) and the [Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction).\n\nWith the Permissions Router API, you can:\n\n- [Add a handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/add) for a specific channel or resource.\n- [Set a default handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/default) for channels that don't have explicit handlers.\n- [Check](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/check) subscriber permissions.\n\n## Setting up permissions\n\nTo set up permissions using the router:\n\n1. Create a `realtime-permissions.js` file in a site's backend.\n2. Import the `permissionsRouter`:\n\n ```js\n import { site } from \"@wix/realtime\";\n const { permissionsRouter } = site;\n ```\n\n3. Define permission handlers using [`add()`](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/add) for specific channels or resources, and [`default()`](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/default) for a default fallback handler:\n\n ```js\n // Set a default handler that grants read access to all subscribers\n permissionsRouter.default((channel, subscriber) => {\n return { read: true };\n });\n\n // Restrict a specific channel to logged-in members\n permissionsRouter.add({ name: \"members-only\" }, (channel, subscriber) => {\n return { read: subscriber.type === \"MEMBER\" };\n });\n ```\n\n4. Export the `realtime_check_permission` hook and call `check()` to delegate to the router:\n\n ```js\n export function realtime_check_permission(channel, subscriber) {\n return permissionsRouter.check(channel, subscriber);\n }\n ```\n\n## Permission resolution\n\nPermissions can be set at the channel level or the resource level. They determine whether subscribers can receive messages published to that channel or resource.\n\nPermissions follow a cascading pattern:\n\n- When a resource [doesn't have a permissions handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/add), the handler for its parent channel runs.\n- When the parent channel doesn't have a permissions handler, the [default permissions handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/default) runs.\n- When no default handler is set, all subscribers receive the default permissions of `{ \"read\": true }`.\n\n> **Note:** Permissions are checked once per subscription attempt, including [re-subscriptions after reconnection](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_reconnection-and-message-sync). Changes to permissions don't affect active subscriptions until the subscriber reconnects.\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- You must create a `realtime-permissions.js` file in a site's backend, even if you don't define any custom permissions. Without it, all subscriptions fail in Wix Studio.\n- When the `realtime_check_permission` hook isn't defined, all subscribers receive the default permissions of `{\"read\": true}`.\n- When previewing a site, `read` permissions are always `true`.\n\n## Use cases\n\nRestrict the `announcements` channel so only logged-in members can receive messages. All other channels remain open to everyone:\n\n```js\nimport { site } from \"@wix/realtime\";\nconst { permissionsRouter } = site;\n\n// Only logged-in members can listen to announcements\npermissionsRouter.add({ name: \"announcements\" }, (channel, subscriber) => {\n return { read: subscriber.type === \"MEMBER\" };\n});\n\n// All other channels are open to everyone\npermissionsRouter.default((channel, subscriber) => {\n return { read: true };\n});\n\nexport function realtime_check_permission(channel, subscriber) {\n return permissionsRouter.check(channel, subscriber);\n}\n```\n\n## See also\n\n- [Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction)\n- [Site API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/introduction)\n- [Subscriber API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction)\n- [Publisher API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/publisher/introduction)\n\n@sdk_package_setup\n"
3718
+ "src": "---\narticleType: intro\n---\n\n# About the Permissions Router API\n\nThe Permissions Router API is a utility for organizing channel permission logic. The router lets you set up a default permissions handler as well as handlers specific to channels or resources.\n\n> **Note:** Alternatively, you can include permissions logic directly in the [`realtime_check_permission()` hook](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/realtime-check-permission).\n\nLearn more about the [Site API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/introduction) and the [Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction).\n\nWith the Permissions Router API, you can:\n\n- [Add a handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/add) for a specific channel or resource.\n- [Set a default handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/default) for channels that don't have explicit handlers.\n- [Check](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/check) subscriber permissions.\n\n## Setting up permissions\n\nTo set up permissions using the router:\n\n1. Create a `realtime-permissions.js` file in a site's backend.\n2. Import the `permissionsRouter`:\n\n ```js\n import { site } from \"@wix/realtime\";\n const { permissionsRouter } = site;\n ```\n\n3. Define permission handlers. Use [`add()`](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/add) for specific channels or resources, and [`default()`](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/default) for a default fallback handler:\n\n ```js\n // Set a default handler that grants read access to all subscribers\n permissionsRouter.default((channel, subscriber) => {\n return { read: true };\n });\n\n // Restrict a specific channel to logged-in members\n permissionsRouter.add({ name: \"members-only\" }, (channel, subscriber) => {\n return { read: subscriber.type === \"MEMBER\" };\n });\n ```\n\n4. Export the `realtime_check_permission` hook and call `check()` in the body of the hook to delegate to the router:\n\n ```js\n export function realtime_check_permission(channel, subscriber) {\n return permissionsRouter.check(channel, subscriber);\n }\n ```\n\n## Permission resolution\n\nPermissions can be set at the channel level or the resource level. They determine whether subscribers can receive messages published to that channel or resource.\n\nPermissions follow a cascading pattern:\n\n- When a resource [doesn't have a permissions handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/add), the handler for its parent channel runs.\n- When the parent channel doesn't have a permissions handler, the [default permissions handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/default) runs.\n- When no default handler is set, all subscribers receive the default permissions of `{ \"read\": true }`.\n\n> **Note:** Permissions are checked once per subscription attempt, including [re-subscriptions after reconnection](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_reconnection-and-message-sync). Changes to permissions don't affect active subscriptions until the subscriber reconnects.\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- You must create a `realtime-permissions.js` file in a site's backend, even if you don't define any custom permissions. Without it, all subscriptions fail in Wix Studio.\n- When the `realtime_check_permission` hook isn't defined, all subscribers receive the default permissions of `{\"read\": true}`.\n- When previewing a site, `read` permissions are always `true`.\n\n## Use cases\n\nRestrict the `announcements` channel so only logged-in members can receive messages. All other channels remain open to everyone:\n\n```js\nimport { site } from \"@wix/realtime\";\nconst { permissionsRouter } = site;\n\n// Only logged-in members can listen to announcements\npermissionsRouter.add({ name: \"announcements\" }, (channel, subscriber) => {\n return { read: subscriber.type === \"MEMBER\" };\n});\n\n// All other channels are open to everyone\npermissionsRouter.default((channel, subscriber) => {\n return { read: true };\n});\n\nexport function realtime_check_permission(channel, subscriber) {\n return permissionsRouter.check(channel, subscriber);\n}\n```\n\n## See also\n\n- [Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction)\n- [Site API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/introduction)\n- [Subscriber API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction)\n- [Publisher API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/publisher/introduction)\n\n@sdk_package_setup\n"
3675
3719
  }
3676
3720
  ],
3677
3721
  "/site/PermissionsRouter/add": [
3678
3722
  {
3679
3723
  "type": "EXAMPLE",
3680
3724
  "title": "Set a permissions handler for a specific channel",
3681
- "src": "// In realtime-permissions.js\n\nimport { site } from \"@wix/realtime\";\nconst { permissionsRouter } = site;\n\n// Only the site owner can listen to announcements\npermissionsRouter.add({ name: \"announcements\" }, (channel, subscriber) => {\n return { read: subscriber.type === \"USER\" };\n});\n\n// Export the hook and delegate to the router\nexport function realtime_check_permission(channel, subscriber) {\n return permissionsRouter.check(channel, subscriber);\n}\n"
3725
+ "src": "// In realtime-permissions.js\n\nimport { site } from \"@wix/realtime\";\nconst { permissionsRouter } = site;\n\n// Only the Wix user can listen to announcements\npermissionsRouter.add({ name: \"announcements\" }, (channel, subscriber) => {\n return { read: subscriber.type === \"USER\" };\n});\n\n// Export the hook and delegate to the router\nexport function realtime_check_permission(channel, subscriber) {\n return permissionsRouter.check(channel, subscriber);\n}\n"
3682
3726
  },
3683
3727
  {
3684
3728
  "type": "EXAMPLE",
@@ -3,7 +3,7 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
3
3
  /**
4
4
  * Publishes a message to a channel or resource.
5
5
  *
6
- * The method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages published to a resource. Similarly, subscribers to a resource don't receive messages published to the parent channel.
6
+ * The method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages sent to a resource on that channel. Similarly, subscribers to a resource don't receive messages sent to its parent channel.
7
7
  *
8
8
  * > **Authentication**
9
9
  * >
@@ -35,9 +35,11 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
35
35
  * await client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });
36
36
  * ```
37
37
  *
38
- * @param channel - Channel and optionally resource to publish to.
38
+ * @param channel - Channel and resource to publish to.
39
39
  * @requiredField channel
40
40
  * @param payload - Message payload. Max: 10 KB.
41
41
  * @requiredField payload
42
+ * @permissionId realtime:v4:message:publish
43
+ * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish
42
44
  */
43
45
  export declare const publish: MaybeContext<BuildRESTFunction<typeof publicPublish> & typeof publicPublish>;
@@ -3,7 +3,7 @@ import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
3
3
  /**
4
4
  * Publishes a message to a channel or resource.
5
5
  *
6
- * The method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages published to a resource. Similarly, subscribers to a resource don't receive messages published to the parent channel.
6
+ * The method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages sent to a resource on that channel. Similarly, subscribers to a resource don't receive messages sent to its parent channel.
7
7
  *
8
8
  * > **Authentication**
9
9
  * >
@@ -35,9 +35,11 @@ import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
35
35
  * await client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });
36
36
  * ```
37
37
  *
38
- * @param channel - Channel and optionally resource to publish to.
38
+ * @param channel - Channel and resource to publish to.
39
39
  * @requiredField channel
40
40
  * @param payload - Message payload. Max: 10 KB.
41
41
  * @requiredField payload
42
+ * @permissionId realtime:v4:message:publish
43
+ * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish
42
44
  */
43
45
  export const publish = /*#__PURE__*/ createRESTModule(publicPublish);
@@ -3,10 +3,12 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
3
3
  /**
4
4
  * Subscribes to a channel or resource.
5
5
  *
6
- * The method attempts to establish a subscription to the specified channel or resource. While the subscription is attempted asynchronously, the method returns the subscription ID immediately.
6
+ * The method attempts to establish a subscription to the specified channel or resource. It returns the subscription ID immediately while the subscription is attempted in the background.
7
7
  *
8
8
  * Use the `options` parameter to register handlers that run whenever the subscription succeeds or generates an error. For some errors, the subscription is re-attempted automatically. The `onSubscribed()` handler runs on every successful re-subscription.
9
9
  *
10
+ * Learn more about the [subscription lifecycle](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_subscription-lifecycle).
11
+ *
10
12
  * @example Subscribe to a channel
11
13
  * ```ts
12
14
  * import { subscriber } from '@wix/realtime';
@@ -44,11 +46,11 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
44
46
  * );
45
47
  * ```
46
48
  *
47
- * @param channel - Channel, and optionally resource, to subscribe to.
49
+ * @param channel - Channel and resource to subscribe to.
48
50
  * @requiredField channel
49
- * @param messageHandler - Callback that runs whenever a message is published to the channel.
51
+ * @param messageHandler - Handler that runs whenever a message is published to the channel or resource.
50
52
  * @requiredField messageHandler
51
- * @param options - Lifecycle handlers for subscription events.
53
+ * @param options - [Lifecycle handlers](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_subscription-lifecycle) for subscription events.
52
54
  */
53
55
  export declare const subscribe: MaybeContext<BuildRESTFunction<typeof publicSubscribe> & typeof publicSubscribe>;
54
56
  /**
@@ -89,7 +91,7 @@ export declare const subscribe: MaybeContext<BuildRESTFunction<typeof publicSubs
89
91
  * client.subscriber.unsubscribe({ channel: { name: 'my-channel' } });
90
92
  * ```
91
93
  *
92
- * @param options - Unsubscribe information. You must specify `channel`, `subscriptionId`, or both.
94
+ * @param options - Unsubscribe details. You must specify `channel`, `subscriptionId`, or both.
93
95
  * @requiredField options
94
96
  */
95
97
  export declare const unsubscribe: MaybeContext<BuildRESTFunction<typeof publicUnsubscribe> & typeof publicUnsubscribe>;
@@ -3,10 +3,12 @@ import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
3
3
  /**
4
4
  * Subscribes to a channel or resource.
5
5
  *
6
- * The method attempts to establish a subscription to the specified channel or resource. While the subscription is attempted asynchronously, the method returns the subscription ID immediately.
6
+ * The method attempts to establish a subscription to the specified channel or resource. It returns the subscription ID immediately while the subscription is attempted in the background.
7
7
  *
8
8
  * Use the `options` parameter to register handlers that run whenever the subscription succeeds or generates an error. For some errors, the subscription is re-attempted automatically. The `onSubscribed()` handler runs on every successful re-subscription.
9
9
  *
10
+ * Learn more about the [subscription lifecycle](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_subscription-lifecycle).
11
+ *
10
12
  * @example Subscribe to a channel
11
13
  * ```ts
12
14
  * import { subscriber } from '@wix/realtime';
@@ -44,11 +46,11 @@ import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
44
46
  * );
45
47
  * ```
46
48
  *
47
- * @param channel - Channel, and optionally resource, to subscribe to.
49
+ * @param channel - Channel and resource to subscribe to.
48
50
  * @requiredField channel
49
- * @param messageHandler - Callback that runs whenever a message is published to the channel.
51
+ * @param messageHandler - Handler that runs whenever a message is published to the channel or resource.
50
52
  * @requiredField messageHandler
51
- * @param options - Lifecycle handlers for subscription events.
53
+ * @param options - [Lifecycle handlers](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction#business-solutions_realtime_realtime_subscriber_subscription-lifecycle) for subscription events.
52
54
  */
53
55
  export const subscribe = /*#__PURE__*/ createRESTModule(publicSubscribe);
54
56
  /**
@@ -89,7 +91,7 @@ export const subscribe = /*#__PURE__*/ createRESTModule(publicSubscribe);
89
91
  * client.subscriber.unsubscribe({ channel: { name: 'my-channel' } });
90
92
  * ```
91
93
  *
92
- * @param options - Unsubscribe information. You must specify `channel`, `subscriptionId`, or both.
94
+ * @param options - Unsubscribe details. You must specify `channel`, `subscriptionId`, or both.
93
95
  * @requiredField options
94
96
  */
95
97
  export const unsubscribe = /*#__PURE__*/ createRESTModule(publicUnsubscribe);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/realtime",
3
- "version": "1.0.42",
3
+ "version": "1.0.44",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -48,7 +48,7 @@
48
48
  "@wix/sdk": "^1.21.4",
49
49
  "@wix/sdk-runtime": "^1.0.9",
50
50
  "@wix/sdk-types": "^1.17.5",
51
- "@wix/sdk_realtime_site": "1.0.33",
51
+ "@wix/sdk_realtime_site": "1.0.34",
52
52
  "uuid": "^11.1.0"
53
53
  },
54
54
  "devDependencies": {
@@ -72,5 +72,5 @@
72
72
  "isRootPublicSdk": true
73
73
  }
74
74
  },
75
- "falconPackageHash": "ca93cf2cc64db9484a449a2efa0b3d4db52d6eb2ccd663d29dda93f2"
75
+ "falconPackageHash": "8a8c30c705ab5222a4ca7b3601b86dc7340a19f9df8c08d419dc65cf"
76
76
  }