@wix/realtime 1.0.18 → 1.0.19
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 +6 -4
- package/cjs/build/publisher/publisher.context.js +6 -4
- package/cjs/build/subscriber/subscriber.context.d.ts +4 -8
- package/cjs/build/subscriber/subscriber.context.js +4 -8
- package/dist/statics/docs-ts-model.json +160 -64
- package/es/build/publisher/publisher.context.d.ts +6 -4
- package/es/build/publisher/publisher.context.js +6 -4
- package/es/build/subscriber/subscriber.context.d.ts +4 -8
- package/es/build/subscriber/subscriber.context.js +4 -8
- package/package.json +2 -2
|
@@ -12,6 +12,11 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
|
|
|
12
12
|
* The client's own credentials (instanceId, metaSiteId) are used directly.
|
|
13
13
|
* This ensures messages are scoped to the correct site.
|
|
14
14
|
*
|
|
15
|
+
* **Contextual client (Wix-hosted) — elevation needed:**
|
|
16
|
+
* The contextual httpClient may not have sufficient permissions on its own.
|
|
17
|
+
* Wrap the call with `elevate()` to obtain the host's backend credentials.
|
|
18
|
+
*
|
|
19
|
+
* @example Manual client (self-hosted / explicit auth)
|
|
15
20
|
* ```ts
|
|
16
21
|
* import { publisher } from '@wix/realtime';
|
|
17
22
|
* import { createClient, AppStrategy } from '@wix/sdk';
|
|
@@ -23,10 +28,7 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
|
|
|
23
28
|
* await client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });
|
|
24
29
|
* ```
|
|
25
30
|
*
|
|
26
|
-
*
|
|
27
|
-
* The contextual httpClient may not have sufficient permissions on its own.
|
|
28
|
-
* Wrap the call with `elevate()` to obtain the host's backend credentials.
|
|
29
|
-
*
|
|
31
|
+
* @example Contextual client (Wix-hosted)
|
|
30
32
|
* ```ts
|
|
31
33
|
* import { publisher } from '@wix/realtime';
|
|
32
34
|
* import { elevate } from '@wix/sdk/context';
|
|
@@ -15,6 +15,11 @@ const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
|
|
|
15
15
|
* The client's own credentials (instanceId, metaSiteId) are used directly.
|
|
16
16
|
* This ensures messages are scoped to the correct site.
|
|
17
17
|
*
|
|
18
|
+
* **Contextual client (Wix-hosted) — elevation needed:**
|
|
19
|
+
* The contextual httpClient may not have sufficient permissions on its own.
|
|
20
|
+
* Wrap the call with `elevate()` to obtain the host's backend credentials.
|
|
21
|
+
*
|
|
22
|
+
* @example Manual client (self-hosted / explicit auth)
|
|
18
23
|
* ```ts
|
|
19
24
|
* import { publisher } from '@wix/realtime';
|
|
20
25
|
* import { createClient, AppStrategy } from '@wix/sdk';
|
|
@@ -26,10 +31,7 @@ const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
|
|
|
26
31
|
* await client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });
|
|
27
32
|
* ```
|
|
28
33
|
*
|
|
29
|
-
*
|
|
30
|
-
* The contextual httpClient may not have sufficient permissions on its own.
|
|
31
|
-
* Wrap the call with `elevate()` to obtain the host's backend credentials.
|
|
32
|
-
*
|
|
34
|
+
* @example Contextual client (Wix-hosted)
|
|
33
35
|
* ```ts
|
|
34
36
|
* import { publisher } from '@wix/realtime';
|
|
35
37
|
* import { elevate } from '@wix/sdk/context';
|
|
@@ -5,8 +5,7 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
|
|
|
5
5
|
* actual connection is established asynchronously in the background. Use the
|
|
6
6
|
* optional `options` parameter to handle subscription lifecycle events.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* @example Manual client (self-hosted / explicit auth)
|
|
10
9
|
* ```ts
|
|
11
10
|
* import { subscriber } from '@wix/realtime';
|
|
12
11
|
* import { createClient, AppStrategy } from '@wix/sdk';
|
|
@@ -28,8 +27,7 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
|
|
|
28
27
|
* );
|
|
29
28
|
* ```
|
|
30
29
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
* @example Contextual client (Wix-hosted)
|
|
33
31
|
* ```ts
|
|
34
32
|
* import { subscriber } from '@wix/realtime';
|
|
35
33
|
*
|
|
@@ -54,8 +52,7 @@ export declare const subscribe: MaybeContext<BuildRESTFunction<typeof publicSubs
|
|
|
54
52
|
* - By `channel` — removes all subscriptions to that channel.
|
|
55
53
|
* - By both — removes the specific subscription, verifying it matches the channel.
|
|
56
54
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
55
|
+
* @example Manual client (self-hosted / explicit auth)
|
|
59
56
|
* ```ts
|
|
60
57
|
* import { subscriber } from '@wix/realtime';
|
|
61
58
|
* import { createClient, AppStrategy } from '@wix/sdk';
|
|
@@ -72,8 +69,7 @@ export declare const subscribe: MaybeContext<BuildRESTFunction<typeof publicSubs
|
|
|
72
69
|
* client.subscriber.unsubscribe({ channel: { name: 'my-channel' } });
|
|
73
70
|
* ```
|
|
74
71
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
72
|
+
* @example Contextual client (Wix-hosted)
|
|
77
73
|
* ```ts
|
|
78
74
|
* import { subscriber } from '@wix/realtime';
|
|
79
75
|
*
|
|
@@ -8,8 +8,7 @@ const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
|
|
|
8
8
|
* actual connection is established asynchronously in the background. Use the
|
|
9
9
|
* optional `options` parameter to handle subscription lifecycle events.
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* @example Manual client (self-hosted / explicit auth)
|
|
13
12
|
* ```ts
|
|
14
13
|
* import { subscriber } from '@wix/realtime';
|
|
15
14
|
* import { createClient, AppStrategy } from '@wix/sdk';
|
|
@@ -31,8 +30,7 @@ const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
|
|
|
31
30
|
* );
|
|
32
31
|
* ```
|
|
33
32
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
33
|
+
* @example Contextual client (Wix-hosted)
|
|
36
34
|
* ```ts
|
|
37
35
|
* import { subscriber } from '@wix/realtime';
|
|
38
36
|
*
|
|
@@ -57,8 +55,7 @@ exports.subscribe = (0, rest_modules_1.createRESTModule)(subscriber_public_js_1.
|
|
|
57
55
|
* - By `channel` — removes all subscriptions to that channel.
|
|
58
56
|
* - By both — removes the specific subscription, verifying it matches the channel.
|
|
59
57
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
58
|
+
* @example Manual client (self-hosted / explicit auth)
|
|
62
59
|
* ```ts
|
|
63
60
|
* import { subscriber } from '@wix/realtime';
|
|
64
61
|
* import { createClient, AppStrategy } from '@wix/sdk';
|
|
@@ -75,8 +72,7 @@ exports.subscribe = (0, rest_modules_1.createRESTModule)(subscriber_public_js_1.
|
|
|
75
72
|
* client.subscriber.unsubscribe({ channel: { name: 'my-channel' } });
|
|
76
73
|
* ```
|
|
77
74
|
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
75
|
+
* @example Contextual client (Wix-hosted)
|
|
80
76
|
* ```ts
|
|
81
77
|
* import { subscriber } from '@wix/realtime';
|
|
82
78
|
*
|
|
@@ -30,15 +30,7 @@
|
|
|
30
30
|
"summary": [
|
|
31
31
|
{
|
|
32
32
|
"kind": "text",
|
|
33
|
-
"text": "Publishes a message to a realtime channel.\n\nMust be called from a backend function (server-to-server) as it requires\napp-level permissions to publish messages via the Duplexer API.\n\nThere are two ways to use this function depending on the Wix client type:\n\n**Manual client (self-hosted / explicit auth) — no elevation needed:**\nThe client's own credentials (instanceId, metaSiteId) are used directly.\nThis ensures messages are scoped to the correct site.\n\n"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"kind": "code",
|
|
37
|
-
"text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { createClient, AppStrategy } from '@wix/sdk';\n\nconst client = createClient({\n modules: { publisher },\n auth: AppStrategy({ appId, appSecret, instanceId }),\n});\nawait client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });\n```"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
"kind": "text",
|
|
41
|
-
"text": "\n\n**Contextual client (Wix-hosted) — elevation needed:**\nThe contextual httpClient may not have sufficient permissions on its own.\nWrap the call with "
|
|
33
|
+
"text": "Publishes a message to a realtime channel.\n\nMust be called from a backend function (server-to-server) as it requires\napp-level permissions to publish messages via the Duplexer API.\n\nThere are two ways to use this function depending on the Wix client type:\n\n**Manual client (self-hosted / explicit auth) — no elevation needed:**\nThe client's own credentials (instanceId, metaSiteId) are used directly.\nThis ensures messages are scoped to the correct site.\n\n**Contextual client (Wix-hosted) — elevation needed:**\nThe contextual httpClient may not have sufficient permissions on its own.\nWrap the call with "
|
|
42
34
|
},
|
|
43
35
|
{
|
|
44
36
|
"kind": "code",
|
|
@@ -46,11 +38,35 @@
|
|
|
46
38
|
},
|
|
47
39
|
{
|
|
48
40
|
"kind": "text",
|
|
49
|
-
"text": " to obtain the host's backend credentials
|
|
41
|
+
"text": " to obtain the host's backend credentials."
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"blockTags": [
|
|
45
|
+
{
|
|
46
|
+
"tag": "@example",
|
|
47
|
+
"content": [
|
|
48
|
+
{
|
|
49
|
+
"kind": "text",
|
|
50
|
+
"text": "Manual client (self-hosted / explicit auth)\n"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"kind": "code",
|
|
54
|
+
"text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { createClient, AppStrategy } from '@wix/sdk';\n\nconst client = createClient({\n modules: { publisher },\n auth: AppStrategy({ appId, appSecret, instanceId }),\n});\nawait client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });\n```"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
50
57
|
},
|
|
51
58
|
{
|
|
52
|
-
"
|
|
53
|
-
"
|
|
59
|
+
"tag": "@example",
|
|
60
|
+
"content": [
|
|
61
|
+
{
|
|
62
|
+
"kind": "text",
|
|
63
|
+
"text": "Contextual client (Wix-hosted)\n"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"kind": "code",
|
|
67
|
+
"text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { elevate } from '@wix/sdk/context';\n\nawait elevate(publisher.publish)({ name: 'my-channel' }, { message: 'hello' });\n```"
|
|
68
|
+
}
|
|
69
|
+
]
|
|
54
70
|
}
|
|
55
71
|
]
|
|
56
72
|
},
|
|
@@ -137,15 +153,7 @@
|
|
|
137
153
|
"summary": [
|
|
138
154
|
{
|
|
139
155
|
"kind": "text",
|
|
140
|
-
"text": "Publishes a message to a realtime channel.\n\nMust be called from a backend function (server-to-server) as it requires\napp-level permissions to publish messages via the Duplexer API.\n\nThere are two ways to use this function depending on the Wix client type:\n\n**Manual client (self-hosted / explicit auth) — no elevation needed:**\nThe client's own credentials (instanceId, metaSiteId) are used directly.\nThis ensures messages are scoped to the correct site.\n\n"
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
"kind": "code",
|
|
144
|
-
"text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { createClient, AppStrategy } from '@wix/sdk';\n\nconst client = createClient({\n modules: { publisher },\n auth: AppStrategy({ appId, appSecret, instanceId }),\n});\nawait client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });\n```"
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"kind": "text",
|
|
148
|
-
"text": "\n\n**Contextual client (Wix-hosted) — elevation needed:**\nThe contextual httpClient may not have sufficient permissions on its own.\nWrap the call with "
|
|
156
|
+
"text": "Publishes a message to a realtime channel.\n\nMust be called from a backend function (server-to-server) as it requires\napp-level permissions to publish messages via the Duplexer API.\n\nThere are two ways to use this function depending on the Wix client type:\n\n**Manual client (self-hosted / explicit auth) — no elevation needed:**\nThe client's own credentials (instanceId, metaSiteId) are used directly.\nThis ensures messages are scoped to the correct site.\n\n**Contextual client (Wix-hosted) — elevation needed:**\nThe contextual httpClient may not have sufficient permissions on its own.\nWrap the call with "
|
|
149
157
|
},
|
|
150
158
|
{
|
|
151
159
|
"kind": "code",
|
|
@@ -153,11 +161,35 @@
|
|
|
153
161
|
},
|
|
154
162
|
{
|
|
155
163
|
"kind": "text",
|
|
156
|
-
"text": " to obtain the host's backend credentials
|
|
164
|
+
"text": " to obtain the host's backend credentials."
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
"blockTags": [
|
|
168
|
+
{
|
|
169
|
+
"tag": "@example",
|
|
170
|
+
"content": [
|
|
171
|
+
{
|
|
172
|
+
"kind": "text",
|
|
173
|
+
"text": "Manual client (self-hosted / explicit auth)\n"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"kind": "code",
|
|
177
|
+
"text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { createClient, AppStrategy } from '@wix/sdk';\n\nconst client = createClient({\n modules: { publisher },\n auth: AppStrategy({ appId, appSecret, instanceId }),\n});\nawait client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });\n```"
|
|
178
|
+
}
|
|
179
|
+
]
|
|
157
180
|
},
|
|
158
181
|
{
|
|
159
|
-
"
|
|
160
|
-
"
|
|
182
|
+
"tag": "@example",
|
|
183
|
+
"content": [
|
|
184
|
+
{
|
|
185
|
+
"kind": "text",
|
|
186
|
+
"text": "Contextual client (Wix-hosted)\n"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"kind": "code",
|
|
190
|
+
"text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { elevate } from '@wix/sdk/context';\n\nawait elevate(publisher.publish)({ name: 'my-channel' }, { message: 'hello' });\n```"
|
|
191
|
+
}
|
|
192
|
+
]
|
|
161
193
|
}
|
|
162
194
|
]
|
|
163
195
|
},
|
|
@@ -932,19 +964,35 @@
|
|
|
932
964
|
},
|
|
933
965
|
{
|
|
934
966
|
"kind": "text",
|
|
935
|
-
"text": " parameter to handle subscription lifecycle events
|
|
936
|
-
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
"text": "```ts\nimport { subscriber } from '@wix/realtime';\nimport { createClient, AppStrategy } from '@wix/sdk';\n\nconst client = createClient({\n modules: { subscriber },\n auth: AppStrategy({ appId, appSecret, instanceId }),\n});\n\nconst subscriptionId = client.subscriber.subscribe(\n { name: 'my-channel' },\n (message, channel) => {\n console.log('Received:', message.payload);\n },\n {\n onSubscribed: (id, isSynced) => console.log('Subscribed', id),\n onSubscriptionError: (error, id) => console.error('Error', error),\n },\n);\n```"
|
|
940
|
-
},
|
|
967
|
+
"text": " parameter to handle subscription lifecycle events."
|
|
968
|
+
}
|
|
969
|
+
],
|
|
970
|
+
"blockTags": [
|
|
941
971
|
{
|
|
942
|
-
"
|
|
943
|
-
"
|
|
972
|
+
"tag": "@example",
|
|
973
|
+
"content": [
|
|
974
|
+
{
|
|
975
|
+
"kind": "text",
|
|
976
|
+
"text": "Manual client (self-hosted / explicit auth)\n"
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
"kind": "code",
|
|
980
|
+
"text": "```ts\nimport { subscriber } from '@wix/realtime';\nimport { createClient, AppStrategy } from '@wix/sdk';\n\nconst client = createClient({\n modules: { subscriber },\n auth: AppStrategy({ appId, appSecret, instanceId }),\n});\n\nconst subscriptionId = client.subscriber.subscribe(\n { name: 'my-channel' },\n (message, channel) => {\n console.log('Received:', message.payload);\n },\n {\n onSubscribed: (id, isSynced) => console.log('Subscribed', id),\n onSubscriptionError: (error, id) => console.error('Error', error),\n },\n);\n```"
|
|
981
|
+
}
|
|
982
|
+
]
|
|
944
983
|
},
|
|
945
984
|
{
|
|
946
|
-
"
|
|
947
|
-
"
|
|
985
|
+
"tag": "@example",
|
|
986
|
+
"content": [
|
|
987
|
+
{
|
|
988
|
+
"kind": "text",
|
|
989
|
+
"text": "Contextual client (Wix-hosted)\n"
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
"kind": "code",
|
|
993
|
+
"text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nconst subscriptionId = subscriber.subscribe(\n { name: 'my-channel' },\n (message, channel) => {\n console.log('Received:', message.payload);\n },\n);\n```"
|
|
994
|
+
}
|
|
995
|
+
]
|
|
948
996
|
}
|
|
949
997
|
]
|
|
950
998
|
},
|
|
@@ -1038,19 +1086,35 @@
|
|
|
1038
1086
|
},
|
|
1039
1087
|
{
|
|
1040
1088
|
"kind": "text",
|
|
1041
|
-
"text": " parameter to handle subscription lifecycle events
|
|
1042
|
-
}
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
"text": "```ts\nimport { subscriber } from '@wix/realtime';\nimport { createClient, AppStrategy } from '@wix/sdk';\n\nconst client = createClient({\n modules: { subscriber },\n auth: AppStrategy({ appId, appSecret, instanceId }),\n});\n\nconst subscriptionId = client.subscriber.subscribe(\n { name: 'my-channel' },\n (message, channel) => {\n console.log('Received:', message.payload);\n },\n {\n onSubscribed: (id, isSynced) => console.log('Subscribed', id),\n onSubscriptionError: (error, id) => console.error('Error', error),\n },\n);\n```"
|
|
1046
|
-
},
|
|
1089
|
+
"text": " parameter to handle subscription lifecycle events."
|
|
1090
|
+
}
|
|
1091
|
+
],
|
|
1092
|
+
"blockTags": [
|
|
1047
1093
|
{
|
|
1048
|
-
"
|
|
1049
|
-
"
|
|
1094
|
+
"tag": "@example",
|
|
1095
|
+
"content": [
|
|
1096
|
+
{
|
|
1097
|
+
"kind": "text",
|
|
1098
|
+
"text": "Manual client (self-hosted / explicit auth)\n"
|
|
1099
|
+
},
|
|
1100
|
+
{
|
|
1101
|
+
"kind": "code",
|
|
1102
|
+
"text": "```ts\nimport { subscriber } from '@wix/realtime';\nimport { createClient, AppStrategy } from '@wix/sdk';\n\nconst client = createClient({\n modules: { subscriber },\n auth: AppStrategy({ appId, appSecret, instanceId }),\n});\n\nconst subscriptionId = client.subscriber.subscribe(\n { name: 'my-channel' },\n (message, channel) => {\n console.log('Received:', message.payload);\n },\n {\n onSubscribed: (id, isSynced) => console.log('Subscribed', id),\n onSubscriptionError: (error, id) => console.error('Error', error),\n },\n);\n```"
|
|
1103
|
+
}
|
|
1104
|
+
]
|
|
1050
1105
|
},
|
|
1051
1106
|
{
|
|
1052
|
-
"
|
|
1053
|
-
"
|
|
1107
|
+
"tag": "@example",
|
|
1108
|
+
"content": [
|
|
1109
|
+
{
|
|
1110
|
+
"kind": "text",
|
|
1111
|
+
"text": "Contextual client (Wix-hosted)\n"
|
|
1112
|
+
},
|
|
1113
|
+
{
|
|
1114
|
+
"kind": "code",
|
|
1115
|
+
"text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nconst subscriptionId = subscriber.subscribe(\n { name: 'my-channel' },\n (message, channel) => {\n console.log('Received:', message.payload);\n },\n);\n```"
|
|
1116
|
+
}
|
|
1117
|
+
]
|
|
1054
1118
|
}
|
|
1055
1119
|
]
|
|
1056
1120
|
},
|
|
@@ -1117,19 +1181,35 @@
|
|
|
1117
1181
|
},
|
|
1118
1182
|
{
|
|
1119
1183
|
"kind": "text",
|
|
1120
|
-
"text": " — removes all subscriptions to that channel.\n- By both — removes the specific subscription, verifying it matches the channel
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
"text": "```ts\nimport { subscriber } from '@wix/realtime';\nimport { createClient, AppStrategy } from '@wix/sdk';\n\nconst client = createClient({\n modules: { subscriber },\n auth: AppStrategy({ appId, appSecret, instanceId }),\n});\n\n// Unsubscribe by subscription ID\nclient.subscriber.unsubscribe({ subscriptionId });\n\n// Unsubscribe from all subscriptions to a channel\nclient.subscriber.unsubscribe({ channel: { name: 'my-channel' } });\n```"
|
|
1125
|
-
},
|
|
1184
|
+
"text": " — removes all subscriptions to that channel.\n- By both — removes the specific subscription, verifying it matches the channel."
|
|
1185
|
+
}
|
|
1186
|
+
],
|
|
1187
|
+
"blockTags": [
|
|
1126
1188
|
{
|
|
1127
|
-
"
|
|
1128
|
-
"
|
|
1189
|
+
"tag": "@example",
|
|
1190
|
+
"content": [
|
|
1191
|
+
{
|
|
1192
|
+
"kind": "text",
|
|
1193
|
+
"text": "Manual client (self-hosted / explicit auth)\n"
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
"kind": "code",
|
|
1197
|
+
"text": "```ts\nimport { subscriber } from '@wix/realtime';\nimport { createClient, AppStrategy } from '@wix/sdk';\n\nconst client = createClient({\n modules: { subscriber },\n auth: AppStrategy({ appId, appSecret, instanceId }),\n});\n\n// Unsubscribe by subscription ID\nclient.subscriber.unsubscribe({ subscriptionId });\n\n// Unsubscribe from all subscriptions to a channel\nclient.subscriber.unsubscribe({ channel: { name: 'my-channel' } });\n```"
|
|
1198
|
+
}
|
|
1199
|
+
]
|
|
1129
1200
|
},
|
|
1130
1201
|
{
|
|
1131
|
-
"
|
|
1132
|
-
"
|
|
1202
|
+
"tag": "@example",
|
|
1203
|
+
"content": [
|
|
1204
|
+
{
|
|
1205
|
+
"kind": "text",
|
|
1206
|
+
"text": "Contextual client (Wix-hosted)\n"
|
|
1207
|
+
},
|
|
1208
|
+
{
|
|
1209
|
+
"kind": "code",
|
|
1210
|
+
"text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nsubscriber.unsubscribe({ subscriptionId });\n```"
|
|
1211
|
+
}
|
|
1212
|
+
]
|
|
1133
1213
|
}
|
|
1134
1214
|
]
|
|
1135
1215
|
},
|
|
@@ -1187,19 +1267,35 @@
|
|
|
1187
1267
|
},
|
|
1188
1268
|
{
|
|
1189
1269
|
"kind": "text",
|
|
1190
|
-
"text": " — removes all subscriptions to that channel.\n- By both — removes the specific subscription, verifying it matches the channel
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
"text": "```ts\nimport { subscriber } from '@wix/realtime';\nimport { createClient, AppStrategy } from '@wix/sdk';\n\nconst client = createClient({\n modules: { subscriber },\n auth: AppStrategy({ appId, appSecret, instanceId }),\n});\n\n// Unsubscribe by subscription ID\nclient.subscriber.unsubscribe({ subscriptionId });\n\n// Unsubscribe from all subscriptions to a channel\nclient.subscriber.unsubscribe({ channel: { name: 'my-channel' } });\n```"
|
|
1195
|
-
},
|
|
1270
|
+
"text": " — removes all subscriptions to that channel.\n- By both — removes the specific subscription, verifying it matches the channel."
|
|
1271
|
+
}
|
|
1272
|
+
],
|
|
1273
|
+
"blockTags": [
|
|
1196
1274
|
{
|
|
1197
|
-
"
|
|
1198
|
-
"
|
|
1275
|
+
"tag": "@example",
|
|
1276
|
+
"content": [
|
|
1277
|
+
{
|
|
1278
|
+
"kind": "text",
|
|
1279
|
+
"text": "Manual client (self-hosted / explicit auth)\n"
|
|
1280
|
+
},
|
|
1281
|
+
{
|
|
1282
|
+
"kind": "code",
|
|
1283
|
+
"text": "```ts\nimport { subscriber } from '@wix/realtime';\nimport { createClient, AppStrategy } from '@wix/sdk';\n\nconst client = createClient({\n modules: { subscriber },\n auth: AppStrategy({ appId, appSecret, instanceId }),\n});\n\n// Unsubscribe by subscription ID\nclient.subscriber.unsubscribe({ subscriptionId });\n\n// Unsubscribe from all subscriptions to a channel\nclient.subscriber.unsubscribe({ channel: { name: 'my-channel' } });\n```"
|
|
1284
|
+
}
|
|
1285
|
+
]
|
|
1199
1286
|
},
|
|
1200
1287
|
{
|
|
1201
|
-
"
|
|
1202
|
-
"
|
|
1288
|
+
"tag": "@example",
|
|
1289
|
+
"content": [
|
|
1290
|
+
{
|
|
1291
|
+
"kind": "text",
|
|
1292
|
+
"text": "Contextual client (Wix-hosted)\n"
|
|
1293
|
+
},
|
|
1294
|
+
{
|
|
1295
|
+
"kind": "code",
|
|
1296
|
+
"text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nsubscriber.unsubscribe({ subscriptionId });\n```"
|
|
1297
|
+
}
|
|
1298
|
+
]
|
|
1203
1299
|
}
|
|
1204
1300
|
]
|
|
1205
1301
|
},
|
|
@@ -12,6 +12,11 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
|
|
|
12
12
|
* The client's own credentials (instanceId, metaSiteId) are used directly.
|
|
13
13
|
* This ensures messages are scoped to the correct site.
|
|
14
14
|
*
|
|
15
|
+
* **Contextual client (Wix-hosted) — elevation needed:**
|
|
16
|
+
* The contextual httpClient may not have sufficient permissions on its own.
|
|
17
|
+
* Wrap the call with `elevate()` to obtain the host's backend credentials.
|
|
18
|
+
*
|
|
19
|
+
* @example Manual client (self-hosted / explicit auth)
|
|
15
20
|
* ```ts
|
|
16
21
|
* import { publisher } from '@wix/realtime';
|
|
17
22
|
* import { createClient, AppStrategy } from '@wix/sdk';
|
|
@@ -23,10 +28,7 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
|
|
|
23
28
|
* await client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });
|
|
24
29
|
* ```
|
|
25
30
|
*
|
|
26
|
-
*
|
|
27
|
-
* The contextual httpClient may not have sufficient permissions on its own.
|
|
28
|
-
* Wrap the call with `elevate()` to obtain the host's backend credentials.
|
|
29
|
-
*
|
|
31
|
+
* @example Contextual client (Wix-hosted)
|
|
30
32
|
* ```ts
|
|
31
33
|
* import { publisher } from '@wix/realtime';
|
|
32
34
|
* import { elevate } from '@wix/sdk/context';
|
|
@@ -12,6 +12,11 @@ import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
|
|
|
12
12
|
* The client's own credentials (instanceId, metaSiteId) are used directly.
|
|
13
13
|
* This ensures messages are scoped to the correct site.
|
|
14
14
|
*
|
|
15
|
+
* **Contextual client (Wix-hosted) — elevation needed:**
|
|
16
|
+
* The contextual httpClient may not have sufficient permissions on its own.
|
|
17
|
+
* Wrap the call with `elevate()` to obtain the host's backend credentials.
|
|
18
|
+
*
|
|
19
|
+
* @example Manual client (self-hosted / explicit auth)
|
|
15
20
|
* ```ts
|
|
16
21
|
* import { publisher } from '@wix/realtime';
|
|
17
22
|
* import { createClient, AppStrategy } from '@wix/sdk';
|
|
@@ -23,10 +28,7 @@ import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
|
|
|
23
28
|
* await client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });
|
|
24
29
|
* ```
|
|
25
30
|
*
|
|
26
|
-
*
|
|
27
|
-
* The contextual httpClient may not have sufficient permissions on its own.
|
|
28
|
-
* Wrap the call with `elevate()` to obtain the host's backend credentials.
|
|
29
|
-
*
|
|
31
|
+
* @example Contextual client (Wix-hosted)
|
|
30
32
|
* ```ts
|
|
31
33
|
* import { publisher } from '@wix/realtime';
|
|
32
34
|
* import { elevate } from '@wix/sdk/context';
|
|
@@ -5,8 +5,7 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
|
|
|
5
5
|
* actual connection is established asynchronously in the background. Use the
|
|
6
6
|
* optional `options` parameter to handle subscription lifecycle events.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* @example Manual client (self-hosted / explicit auth)
|
|
10
9
|
* ```ts
|
|
11
10
|
* import { subscriber } from '@wix/realtime';
|
|
12
11
|
* import { createClient, AppStrategy } from '@wix/sdk';
|
|
@@ -28,8 +27,7 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
|
|
|
28
27
|
* );
|
|
29
28
|
* ```
|
|
30
29
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
* @example Contextual client (Wix-hosted)
|
|
33
31
|
* ```ts
|
|
34
32
|
* import { subscriber } from '@wix/realtime';
|
|
35
33
|
*
|
|
@@ -54,8 +52,7 @@ export declare const subscribe: MaybeContext<BuildRESTFunction<typeof publicSubs
|
|
|
54
52
|
* - By `channel` — removes all subscriptions to that channel.
|
|
55
53
|
* - By both — removes the specific subscription, verifying it matches the channel.
|
|
56
54
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
55
|
+
* @example Manual client (self-hosted / explicit auth)
|
|
59
56
|
* ```ts
|
|
60
57
|
* import { subscriber } from '@wix/realtime';
|
|
61
58
|
* import { createClient, AppStrategy } from '@wix/sdk';
|
|
@@ -72,8 +69,7 @@ export declare const subscribe: MaybeContext<BuildRESTFunction<typeof publicSubs
|
|
|
72
69
|
* client.subscriber.unsubscribe({ channel: { name: 'my-channel' } });
|
|
73
70
|
* ```
|
|
74
71
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
72
|
+
* @example Contextual client (Wix-hosted)
|
|
77
73
|
* ```ts
|
|
78
74
|
* import { subscriber } from '@wix/realtime';
|
|
79
75
|
*
|
|
@@ -5,8 +5,7 @@ import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
|
|
|
5
5
|
* actual connection is established asynchronously in the background. Use the
|
|
6
6
|
* optional `options` parameter to handle subscription lifecycle events.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* @example Manual client (self-hosted / explicit auth)
|
|
10
9
|
* ```ts
|
|
11
10
|
* import { subscriber } from '@wix/realtime';
|
|
12
11
|
* import { createClient, AppStrategy } from '@wix/sdk';
|
|
@@ -28,8 +27,7 @@ import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
|
|
|
28
27
|
* );
|
|
29
28
|
* ```
|
|
30
29
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
30
|
+
* @example Contextual client (Wix-hosted)
|
|
33
31
|
* ```ts
|
|
34
32
|
* import { subscriber } from '@wix/realtime';
|
|
35
33
|
*
|
|
@@ -54,8 +52,7 @@ export const subscribe = /*#__PURE__*/ createRESTModule(publicSubscribe);
|
|
|
54
52
|
* - By `channel` — removes all subscriptions to that channel.
|
|
55
53
|
* - By both — removes the specific subscription, verifying it matches the channel.
|
|
56
54
|
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
55
|
+
* @example Manual client (self-hosted / explicit auth)
|
|
59
56
|
* ```ts
|
|
60
57
|
* import { subscriber } from '@wix/realtime';
|
|
61
58
|
* import { createClient, AppStrategy } from '@wix/sdk';
|
|
@@ -72,8 +69,7 @@ export const subscribe = /*#__PURE__*/ createRESTModule(publicSubscribe);
|
|
|
72
69
|
* client.subscriber.unsubscribe({ channel: { name: 'my-channel' } });
|
|
73
70
|
* ```
|
|
74
71
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
72
|
+
* @example Contextual client (Wix-hosted)
|
|
77
73
|
* ```ts
|
|
78
74
|
* import { subscriber } from '@wix/realtime';
|
|
79
75
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/realtime",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"isRootPublicSdk": true
|
|
66
66
|
}
|
|
67
67
|
},
|
|
68
|
-
"falconPackageHash": "
|
|
68
|
+
"falconPackageHash": "0f6203e22006cc834d66b9cc82bded26cd4ca19d4ca96f07dfad8664"
|
|
69
69
|
}
|