@wix/realtime 1.0.18 → 1.0.20

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,15 +3,10 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
3
3
  /**
4
4
  * Publishes a message to a realtime channel.
5
5
  *
6
- * Must be called from a backend function (server-to-server) as it requires
7
- * app-level permissions to publish messages via the Duplexer API.
8
- *
9
- * There are two ways to use this function depending on the Wix client type:
10
- *
11
- * **Manual client (self-hosted / explicit auth) — no elevation needed:**
12
- * The client's own credentials (instanceId, metaSiteId) are used directly.
13
- * This ensures messages are scoped to the correct site.
6
+ * Requires a service identity (server-side only). The caller must have
7
+ * app-level permissions to publish messages.
14
8
  *
9
+ * @example Manual client (self-hosted / explicit auth)
15
10
  * ```ts
16
11
  * import { publisher } from '@wix/realtime';
17
12
  * import { createClient, AppStrategy } from '@wix/sdk';
@@ -23,10 +18,7 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
23
18
  * await client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });
24
19
  * ```
25
20
  *
26
- * **Contextual client (Wix-hosted) — elevation needed:**
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
- *
21
+ * @example Contextual client (Wix-hosted)
30
22
  * ```ts
31
23
  * import { publisher } from '@wix/realtime';
32
24
  * import { elevate } from '@wix/sdk/context';
@@ -6,15 +6,10 @@ const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
6
6
  /**
7
7
  * Publishes a message to a realtime channel.
8
8
  *
9
- * Must be called from a backend function (server-to-server) as it requires
10
- * app-level permissions to publish messages via the Duplexer API.
11
- *
12
- * There are two ways to use this function depending on the Wix client type:
13
- *
14
- * **Manual client (self-hosted / explicit auth) — no elevation needed:**
15
- * The client's own credentials (instanceId, metaSiteId) are used directly.
16
- * This ensures messages are scoped to the correct site.
9
+ * Requires a service identity (server-side only). The caller must have
10
+ * app-level permissions to publish messages.
17
11
  *
12
+ * @example Manual client (self-hosted / explicit auth)
18
13
  * ```ts
19
14
  * import { publisher } from '@wix/realtime';
20
15
  * import { createClient, AppStrategy } from '@wix/sdk';
@@ -26,10 +21,7 @@ const rest_modules_1 = require("@wix/sdk-runtime/rest-modules");
26
21
  * await client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });
27
22
  * ```
28
23
  *
29
- * **Contextual client (Wix-hosted) — elevation needed:**
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
- *
24
+ * @example Contextual client (Wix-hosted)
33
25
  * ```ts
34
26
  * import { publisher } from '@wix/realtime';
35
27
  * 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
- * **Manual client (self-hosted / explicit auth):**
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
- * **Contextual client (Wix-hosted):**
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
- * **Manual client (self-hosted / explicit auth):**
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
- * **Contextual client (Wix-hosted):**
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
- * **Manual client (self-hosted / explicit auth):**
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
- * **Contextual client (Wix-hosted):**
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
- * **Manual client (self-hosted / explicit auth):**
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
- * **Contextual client (Wix-hosted):**
79
- *
75
+ * @example Contextual client (Wix-hosted)
80
76
  * ```ts
81
77
  * import { subscriber } from '@wix/realtime';
82
78
  *
@@ -30,27 +30,35 @@
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 "
42
- },
43
- {
44
- "kind": "code",
45
- "text": "`elevate()`"
46
- },
33
+ "text": "Publishes a message to a realtime channel.\n\nRequires a service identity (server-side only). The caller must have\napp-level permissions to publish messages."
34
+ }
35
+ ],
36
+ "blockTags": [
47
37
  {
48
- "kind": "text",
49
- "text": " to obtain the host's backend credentials.\n\n"
38
+ "tag": "@example",
39
+ "content": [
40
+ {
41
+ "kind": "text",
42
+ "text": "Manual client (self-hosted / explicit auth)\n"
43
+ },
44
+ {
45
+ "kind": "code",
46
+ "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```"
47
+ }
48
+ ]
50
49
  },
51
50
  {
52
- "kind": "code",
53
- "text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { elevate } from '@wix/sdk/context';\n\nawait elevate(publisher.publish)({ name: 'my-channel' }, { message: 'hello' });\n```"
51
+ "tag": "@example",
52
+ "content": [
53
+ {
54
+ "kind": "text",
55
+ "text": "Contextual client (Wix-hosted)\n"
56
+ },
57
+ {
58
+ "kind": "code",
59
+ "text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { elevate } from '@wix/sdk/context';\n\nawait elevate(publisher.publish)({ name: 'my-channel' }, { message: 'hello' });\n```"
60
+ }
61
+ ]
54
62
  }
55
63
  ]
56
64
  },
@@ -137,27 +145,35 @@
137
145
  "summary": [
138
146
  {
139
147
  "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 "
149
- },
150
- {
151
- "kind": "code",
152
- "text": "`elevate()`"
153
- },
148
+ "text": "Publishes a message to a realtime channel.\n\nRequires a service identity (server-side only). The caller must have\napp-level permissions to publish messages."
149
+ }
150
+ ],
151
+ "blockTags": [
154
152
  {
155
- "kind": "text",
156
- "text": " to obtain the host's backend credentials.\n\n"
153
+ "tag": "@example",
154
+ "content": [
155
+ {
156
+ "kind": "text",
157
+ "text": "Manual client (self-hosted / explicit auth)\n"
158
+ },
159
+ {
160
+ "kind": "code",
161
+ "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```"
162
+ }
163
+ ]
157
164
  },
158
165
  {
159
- "kind": "code",
160
- "text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { elevate } from '@wix/sdk/context';\n\nawait elevate(publisher.publish)({ name: 'my-channel' }, { message: 'hello' });\n```"
166
+ "tag": "@example",
167
+ "content": [
168
+ {
169
+ "kind": "text",
170
+ "text": "Contextual client (Wix-hosted)\n"
171
+ },
172
+ {
173
+ "kind": "code",
174
+ "text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { elevate } from '@wix/sdk/context';\n\nawait elevate(publisher.publish)({ name: 'my-channel' }, { message: 'hello' });\n```"
175
+ }
176
+ ]
161
177
  }
162
178
  ]
163
179
  },
@@ -932,19 +948,35 @@
932
948
  },
933
949
  {
934
950
  "kind": "text",
935
- "text": " parameter to handle subscription lifecycle events.\n\n**Manual client (self-hosted / explicit auth):**\n\n"
936
- },
937
- {
938
- "kind": "code",
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
- },
951
+ "text": " parameter to handle subscription lifecycle events."
952
+ }
953
+ ],
954
+ "blockTags": [
941
955
  {
942
- "kind": "text",
943
- "text": "\n\n**Contextual client (Wix-hosted):**\n\n"
956
+ "tag": "@example",
957
+ "content": [
958
+ {
959
+ "kind": "text",
960
+ "text": "Manual client (self-hosted / explicit auth)\n"
961
+ },
962
+ {
963
+ "kind": "code",
964
+ "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```"
965
+ }
966
+ ]
944
967
  },
945
968
  {
946
- "kind": "code",
947
- "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```"
969
+ "tag": "@example",
970
+ "content": [
971
+ {
972
+ "kind": "text",
973
+ "text": "Contextual client (Wix-hosted)\n"
974
+ },
975
+ {
976
+ "kind": "code",
977
+ "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```"
978
+ }
979
+ ]
948
980
  }
949
981
  ]
950
982
  },
@@ -1038,19 +1070,35 @@
1038
1070
  },
1039
1071
  {
1040
1072
  "kind": "text",
1041
- "text": " parameter to handle subscription lifecycle events.\n\n**Manual client (self-hosted / explicit auth):**\n\n"
1042
- },
1043
- {
1044
- "kind": "code",
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
- },
1073
+ "text": " parameter to handle subscription lifecycle events."
1074
+ }
1075
+ ],
1076
+ "blockTags": [
1047
1077
  {
1048
- "kind": "text",
1049
- "text": "\n\n**Contextual client (Wix-hosted):**\n\n"
1078
+ "tag": "@example",
1079
+ "content": [
1080
+ {
1081
+ "kind": "text",
1082
+ "text": "Manual client (self-hosted / explicit auth)\n"
1083
+ },
1084
+ {
1085
+ "kind": "code",
1086
+ "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```"
1087
+ }
1088
+ ]
1050
1089
  },
1051
1090
  {
1052
- "kind": "code",
1053
- "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```"
1091
+ "tag": "@example",
1092
+ "content": [
1093
+ {
1094
+ "kind": "text",
1095
+ "text": "Contextual client (Wix-hosted)\n"
1096
+ },
1097
+ {
1098
+ "kind": "code",
1099
+ "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```"
1100
+ }
1101
+ ]
1054
1102
  }
1055
1103
  ]
1056
1104
  },
@@ -1117,19 +1165,35 @@
1117
1165
  },
1118
1166
  {
1119
1167
  "kind": "text",
1120
- "text": " — removes all subscriptions to that channel.\n- By both — removes the specific subscription, verifying it matches the channel.\n\n**Manual client (self-hosted / explicit auth):**\n\n"
1121
- },
1122
- {
1123
- "kind": "code",
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
- },
1168
+ "text": " — removes all subscriptions to that channel.\n- By both — removes the specific subscription, verifying it matches the channel."
1169
+ }
1170
+ ],
1171
+ "blockTags": [
1126
1172
  {
1127
- "kind": "text",
1128
- "text": "\n\n**Contextual client (Wix-hosted):**\n\n"
1173
+ "tag": "@example",
1174
+ "content": [
1175
+ {
1176
+ "kind": "text",
1177
+ "text": "Manual client (self-hosted / explicit auth)\n"
1178
+ },
1179
+ {
1180
+ "kind": "code",
1181
+ "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```"
1182
+ }
1183
+ ]
1129
1184
  },
1130
1185
  {
1131
- "kind": "code",
1132
- "text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nsubscriber.unsubscribe({ subscriptionId });\n```"
1186
+ "tag": "@example",
1187
+ "content": [
1188
+ {
1189
+ "kind": "text",
1190
+ "text": "Contextual client (Wix-hosted)\n"
1191
+ },
1192
+ {
1193
+ "kind": "code",
1194
+ "text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nsubscriber.unsubscribe({ subscriptionId });\n```"
1195
+ }
1196
+ ]
1133
1197
  }
1134
1198
  ]
1135
1199
  },
@@ -1187,19 +1251,35 @@
1187
1251
  },
1188
1252
  {
1189
1253
  "kind": "text",
1190
- "text": " — removes all subscriptions to that channel.\n- By both — removes the specific subscription, verifying it matches the channel.\n\n**Manual client (self-hosted / explicit auth):**\n\n"
1191
- },
1192
- {
1193
- "kind": "code",
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
- },
1254
+ "text": " — removes all subscriptions to that channel.\n- By both — removes the specific subscription, verifying it matches the channel."
1255
+ }
1256
+ ],
1257
+ "blockTags": [
1196
1258
  {
1197
- "kind": "text",
1198
- "text": "\n\n**Contextual client (Wix-hosted):**\n\n"
1259
+ "tag": "@example",
1260
+ "content": [
1261
+ {
1262
+ "kind": "text",
1263
+ "text": "Manual client (self-hosted / explicit auth)\n"
1264
+ },
1265
+ {
1266
+ "kind": "code",
1267
+ "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```"
1268
+ }
1269
+ ]
1199
1270
  },
1200
1271
  {
1201
- "kind": "code",
1202
- "text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nsubscriber.unsubscribe({ subscriptionId });\n```"
1272
+ "tag": "@example",
1273
+ "content": [
1274
+ {
1275
+ "kind": "text",
1276
+ "text": "Contextual client (Wix-hosted)\n"
1277
+ },
1278
+ {
1279
+ "kind": "code",
1280
+ "text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nsubscriber.unsubscribe({ subscriptionId });\n```"
1281
+ }
1282
+ ]
1203
1283
  }
1204
1284
  ]
1205
1285
  },
@@ -3,15 +3,10 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
3
3
  /**
4
4
  * Publishes a message to a realtime channel.
5
5
  *
6
- * Must be called from a backend function (server-to-server) as it requires
7
- * app-level permissions to publish messages via the Duplexer API.
8
- *
9
- * There are two ways to use this function depending on the Wix client type:
10
- *
11
- * **Manual client (self-hosted / explicit auth) — no elevation needed:**
12
- * The client's own credentials (instanceId, metaSiteId) are used directly.
13
- * This ensures messages are scoped to the correct site.
6
+ * Requires a service identity (server-side only). The caller must have
7
+ * app-level permissions to publish messages.
14
8
  *
9
+ * @example Manual client (self-hosted / explicit auth)
15
10
  * ```ts
16
11
  * import { publisher } from '@wix/realtime';
17
12
  * import { createClient, AppStrategy } from '@wix/sdk';
@@ -23,10 +18,7 @@ import type { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';
23
18
  * await client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });
24
19
  * ```
25
20
  *
26
- * **Contextual client (Wix-hosted) — elevation needed:**
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
- *
21
+ * @example Contextual client (Wix-hosted)
30
22
  * ```ts
31
23
  * import { publisher } from '@wix/realtime';
32
24
  * import { elevate } from '@wix/sdk/context';
@@ -3,15 +3,10 @@ import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
3
3
  /**
4
4
  * Publishes a message to a realtime channel.
5
5
  *
6
- * Must be called from a backend function (server-to-server) as it requires
7
- * app-level permissions to publish messages via the Duplexer API.
8
- *
9
- * There are two ways to use this function depending on the Wix client type:
10
- *
11
- * **Manual client (self-hosted / explicit auth) — no elevation needed:**
12
- * The client's own credentials (instanceId, metaSiteId) are used directly.
13
- * This ensures messages are scoped to the correct site.
6
+ * Requires a service identity (server-side only). The caller must have
7
+ * app-level permissions to publish messages.
14
8
  *
9
+ * @example Manual client (self-hosted / explicit auth)
15
10
  * ```ts
16
11
  * import { publisher } from '@wix/realtime';
17
12
  * import { createClient, AppStrategy } from '@wix/sdk';
@@ -23,10 +18,7 @@ import { createRESTModule } from '@wix/sdk-runtime/rest-modules';
23
18
  * await client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });
24
19
  * ```
25
20
  *
26
- * **Contextual client (Wix-hosted) — elevation needed:**
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
- *
21
+ * @example Contextual client (Wix-hosted)
30
22
  * ```ts
31
23
  * import { publisher } from '@wix/realtime';
32
24
  * 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
- * **Manual client (self-hosted / explicit auth):**
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
- * **Contextual client (Wix-hosted):**
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
- * **Manual client (self-hosted / explicit auth):**
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
- * **Contextual client (Wix-hosted):**
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
- * **Manual client (self-hosted / explicit auth):**
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
- * **Contextual client (Wix-hosted):**
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
- * **Manual client (self-hosted / explicit auth):**
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
- * **Contextual client (Wix-hosted):**
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.18",
3
+ "version": "1.0.20",
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": "fe8c2a94e3d494c7683d22a3b4943a1e3883c91df788345d96d1425c"
68
+ "falconPackageHash": "82d3f100a96e40080a9baa30aa3a633e5bdcbf2c815a93c6997ebfa4"
69
69
  }