@wix/realtime 1.0.42 → 1.0.43
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.
- package/cjs/build/publisher/publisher.context.d.ts +2 -2
- package/cjs/build/publisher/publisher.context.js +2 -2
- package/cjs/build/subscriber/subscriber.context.d.ts +7 -5
- package/cjs/build/subscriber/subscriber.context.js +7 -5
- package/dist/statics/docs-ts-model.json +34 -26
- package/es/build/publisher/publisher.context.d.ts +2 -2
- package/es/build/publisher/publisher.context.js +2 -2
- package/es/build/subscriber/subscriber.context.d.ts +7 -5
- package/es/build/subscriber/subscriber.context.js +7 -5
- package/package.json +3 -3
|
@@ -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
|
|
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,7 +35,7 @@ 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
|
|
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
|
|
@@ -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
|
|
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,7 +38,7 @@ 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
|
|
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
|
|
@@ -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.
|
|
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
|
|
49
|
+
* @param channel - Channel and resource to subscribe to.
|
|
48
50
|
* @requiredField channel
|
|
49
|
-
* @param messageHandler -
|
|
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
|
|
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.
|
|
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
|
|
52
|
+
* @param channel - Channel and resource to subscribe to.
|
|
51
53
|
* @requiredField channel
|
|
52
|
-
* @param messageHandler -
|
|
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
|
|
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
|
|
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": [
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"summary": [
|
|
100
100
|
{
|
|
101
101
|
"kind": "text",
|
|
102
|
-
"text": "Channel and
|
|
102
|
+
"text": "Channel and resource to publish to."
|
|
103
103
|
}
|
|
104
104
|
]
|
|
105
105
|
},
|
|
@@ -171,7 +171,7 @@
|
|
|
171
171
|
"summary": [
|
|
172
172
|
{
|
|
173
173
|
"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
|
|
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 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
175
|
}
|
|
176
176
|
],
|
|
177
177
|
"blockTags": [
|
|
@@ -307,7 +307,7 @@
|
|
|
307
307
|
"summary": [
|
|
308
308
|
{
|
|
309
309
|
"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
|
|
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 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
311
|
}
|
|
312
312
|
],
|
|
313
313
|
"blockTags": [
|
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
"summary": [
|
|
361
361
|
{
|
|
362
362
|
"kind": "text",
|
|
363
|
-
"text": "Channel or resource to
|
|
363
|
+
"text": "Channel or resource to add the permissions handler for."
|
|
364
364
|
}
|
|
365
365
|
]
|
|
366
366
|
},
|
|
@@ -381,7 +381,7 @@
|
|
|
381
381
|
"summary": [
|
|
382
382
|
{
|
|
383
383
|
"kind": "text",
|
|
384
|
-
"text": "Handler
|
|
384
|
+
"text": "Handler that runs when checking permissions for the specified channel."
|
|
385
385
|
}
|
|
386
386
|
]
|
|
387
387
|
},
|
|
@@ -437,7 +437,7 @@
|
|
|
437
437
|
"summary": [
|
|
438
438
|
{
|
|
439
439
|
"kind": "text",
|
|
440
|
-
"text": "Checks permissions for a subscriber on a channel or resource.\n\nRuns the
|
|
440
|
+
"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
441
|
},
|
|
442
442
|
{
|
|
443
443
|
"kind": "code",
|
|
@@ -445,7 +445,7 @@
|
|
|
445
445
|
},
|
|
446
446
|
{
|
|
447
447
|
"kind": "text",
|
|
448
|
-
"text": "](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/realtime-check-permission) hook
|
|
448
|
+
"text": "](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/realtime-check-permission) hook."
|
|
449
449
|
}
|
|
450
450
|
],
|
|
451
451
|
"blockTags": [
|
|
@@ -597,7 +597,7 @@
|
|
|
597
597
|
"summary": [
|
|
598
598
|
{
|
|
599
599
|
"kind": "text",
|
|
600
|
-
"text": "Sets the default permissions handler.\n\nThe default handler runs when no explicit handler is set for
|
|
600
|
+
"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
601
|
}
|
|
602
602
|
],
|
|
603
603
|
"blockTags": [
|
|
@@ -841,7 +841,7 @@
|
|
|
841
841
|
"summary": [
|
|
842
842
|
{
|
|
843
843
|
"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
|
|
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 handlers. Learn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
|
|
845
845
|
}
|
|
846
846
|
],
|
|
847
847
|
"blockTags": [
|
|
@@ -1111,7 +1111,7 @@
|
|
|
1111
1111
|
"summary": [
|
|
1112
1112
|
{
|
|
1113
1113
|
"kind": "text",
|
|
1114
|
-
"text": "Sets the default permissions handler.\n\nThe default handler runs when no explicit handler is set for
|
|
1114
|
+
"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
1115
|
}
|
|
1116
1116
|
],
|
|
1117
1117
|
"blockTags": [
|
|
@@ -1754,7 +1754,7 @@
|
|
|
1754
1754
|
"summary": [
|
|
1755
1755
|
{
|
|
1756
1756
|
"kind": "text",
|
|
1757
|
-
"text": "Checks permissions for a subscriber on a channel or resource.\n\
|
|
1757
|
+
"text": "Checks permissions for a subscriber on a channel or resource.\n\nSet up this hook as a named export in the "
|
|
1758
1758
|
},
|
|
1759
1759
|
{
|
|
1760
1760
|
"kind": "code",
|
|
@@ -1762,7 +1762,15 @@
|
|
|
1762
1762
|
},
|
|
1763
1763
|
{
|
|
1764
1764
|
"kind": "text",
|
|
1765
|
-
"text": " file in a site's backend
|
|
1765
|
+
"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 ["
|
|
1766
|
+
},
|
|
1767
|
+
{
|
|
1768
|
+
"kind": "code",
|
|
1769
|
+
"text": "`check()`"
|
|
1770
|
+
},
|
|
1771
|
+
{
|
|
1772
|
+
"kind": "text",
|
|
1773
|
+
"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
1774
|
}
|
|
1767
1775
|
],
|
|
1768
1776
|
"blockTags": [
|
|
@@ -1942,7 +1950,7 @@
|
|
|
1942
1950
|
"summary": [
|
|
1943
1951
|
{
|
|
1944
1952
|
"kind": "text",
|
|
1945
|
-
"text": "Subscribes to a channel or resource.\n\nThe method attempts to establish a subscription to the specified channel or resource.
|
|
1953
|
+
"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
1954
|
},
|
|
1947
1955
|
{
|
|
1948
1956
|
"kind": "code",
|
|
@@ -1958,7 +1966,7 @@
|
|
|
1958
1966
|
},
|
|
1959
1967
|
{
|
|
1960
1968
|
"kind": "text",
|
|
1961
|
-
"text": " handler runs on every successful re-subscription."
|
|
1969
|
+
"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
1970
|
}
|
|
1963
1971
|
],
|
|
1964
1972
|
"blockTags": [
|
|
@@ -2019,7 +2027,7 @@
|
|
|
2019
2027
|
"summary": [
|
|
2020
2028
|
{
|
|
2021
2029
|
"kind": "text",
|
|
2022
|
-
"text": "Channel
|
|
2030
|
+
"text": "Channel and resource to subscribe to."
|
|
2023
2031
|
}
|
|
2024
2032
|
]
|
|
2025
2033
|
},
|
|
@@ -2040,7 +2048,7 @@
|
|
|
2040
2048
|
"summary": [
|
|
2041
2049
|
{
|
|
2042
2050
|
"kind": "text",
|
|
2043
|
-
"text": "
|
|
2051
|
+
"text": "Handler that runs whenever a message is published to the channel or resource."
|
|
2044
2052
|
}
|
|
2045
2053
|
]
|
|
2046
2054
|
},
|
|
@@ -2063,7 +2071,7 @@
|
|
|
2063
2071
|
"summary": [
|
|
2064
2072
|
{
|
|
2065
2073
|
"kind": "text",
|
|
2066
|
-
"text": "Lifecycle handlers for subscription events."
|
|
2074
|
+
"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
2075
|
}
|
|
2068
2076
|
]
|
|
2069
2077
|
},
|
|
@@ -2090,7 +2098,7 @@
|
|
|
2090
2098
|
"summary": [
|
|
2091
2099
|
{
|
|
2092
2100
|
"kind": "text",
|
|
2093
|
-
"text": "Subscribes to a channel or resource.\n\nThe method attempts to establish a subscription to the specified channel or resource.
|
|
2101
|
+
"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
2102
|
},
|
|
2095
2103
|
{
|
|
2096
2104
|
"kind": "code",
|
|
@@ -2106,7 +2114,7 @@
|
|
|
2106
2114
|
},
|
|
2107
2115
|
{
|
|
2108
2116
|
"kind": "text",
|
|
2109
|
-
"text": " handler runs on every successful re-subscription."
|
|
2117
|
+
"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
2118
|
}
|
|
2111
2119
|
],
|
|
2112
2120
|
"blockTags": [
|
|
@@ -2271,7 +2279,7 @@
|
|
|
2271
2279
|
"summary": [
|
|
2272
2280
|
{
|
|
2273
2281
|
"kind": "text",
|
|
2274
|
-
"text": "Unsubscribe
|
|
2282
|
+
"text": "Unsubscribe details. You must specify "
|
|
2275
2283
|
},
|
|
2276
2284
|
{
|
|
2277
2285
|
"kind": "code",
|
|
@@ -3584,7 +3592,7 @@
|
|
|
3584
3592
|
{
|
|
3585
3593
|
"type": "GUIDE",
|
|
3586
3594
|
"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"
|
|
3595
|
+
"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
3596
|
},
|
|
3589
3597
|
{
|
|
3590
3598
|
"type": "GUIDE",
|
|
@@ -3596,7 +3604,7 @@
|
|
|
3596
3604
|
{
|
|
3597
3605
|
"type": "GUIDE",
|
|
3598
3606
|
"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)
|
|
3607
|
+
"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
3608
|
},
|
|
3601
3609
|
{
|
|
3602
3610
|
"type": "GUIDE",
|
|
@@ -3608,7 +3616,7 @@
|
|
|
3608
3616
|
{
|
|
3609
3617
|
"type": "GUIDE",
|
|
3610
3618
|
"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-
|
|
3619
|
+
"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
3620
|
},
|
|
3613
3621
|
{
|
|
3614
3622
|
"type": "GUIDE",
|
|
@@ -3671,14 +3679,14 @@
|
|
|
3671
3679
|
{
|
|
3672
3680
|
"type": "GUIDE",
|
|
3673
3681
|
"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
|
|
3682
|
+
"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
3683
|
}
|
|
3676
3684
|
],
|
|
3677
3685
|
"/site/PermissionsRouter/add": [
|
|
3678
3686
|
{
|
|
3679
3687
|
"type": "EXAMPLE",
|
|
3680
3688
|
"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
|
|
3689
|
+
"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
3690
|
},
|
|
3683
3691
|
{
|
|
3684
3692
|
"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
|
|
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,7 +35,7 @@ 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
|
|
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
|
|
@@ -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
|
|
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,7 +35,7 @@ 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
|
|
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
|
|
@@ -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.
|
|
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
|
|
49
|
+
* @param channel - Channel and resource to subscribe to.
|
|
48
50
|
* @requiredField channel
|
|
49
|
-
* @param messageHandler -
|
|
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
|
|
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.
|
|
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
|
|
49
|
+
* @param channel - Channel and resource to subscribe to.
|
|
48
50
|
* @requiredField channel
|
|
49
|
-
* @param messageHandler -
|
|
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
|
|
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.
|
|
3
|
+
"version": "1.0.43",
|
|
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.
|
|
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": "
|
|
75
|
+
"falconPackageHash": "98a58218df0dbaf6198e0884b49f7b38343e8de6e3e82f8d76a1ca2d"
|
|
76
76
|
}
|