@wix/realtime 1.0.34 → 1.0.36

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.
@@ -38,15 +38,7 @@
38
38
  "summary": [
39
39
  {
40
40
  "kind": "text",
41
- "text": "Publishes a message to a channel or channel resource.\n\nAll subscribers currently listening to the specified channel receive the\nmessage. Subscribers to a channel don't receive messages published to a\nresource on that channel, and vice versa.\n\nThis method is backend-only and requires elevated permissions.\n\n<!-- TODO: Check whether this API is relevant for headless projects. -->\n\n> **Note:** This function requires elevated permissions and runs only on the backend.\n> You can also call this method from the frontend using "
42
- },
43
- {
44
- "kind": "code",
45
- "text": "`elevate()`"
46
- },
47
- {
48
- "kind": "text",
49
- "text": ".\n> Elevated permissions are only available for apps and service accounts."
41
+ "text": "Publishes a message to a channel or resource.\n\nThe method publishes a message to all subscriptions on the specified channel or resource. Channels and resources are isolated, so subscribers to a channel don't receive messages published to a resource. Similarly, subscribers to a resource don't receive messages published to the parent channel.\n\n> **Authentication**\n>\n> This method may require higher-level permissions than the caller has, based on their [identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities) and [roles and permissions](https://support.wix.com/en/article/roles-permissions-overview). In these cases, you can ensure the method is called with the required level of authorization by using [elevated permissions](https://dev.wix.com/docs/api-reference/articles/authentication/about-elevated-permissions).\n\n<!-- TODO: Check whether this API is relevant for headless projects. -->"
50
42
  }
51
43
  ],
52
44
  "blockTags": [
@@ -55,11 +47,11 @@
55
47
  "content": [
56
48
  {
57
49
  "kind": "text",
58
- "text": "Manual client (self-hosted / explicit auth)\n"
50
+ "text": "Publish a message to the specified channel\n"
59
51
  },
60
52
  {
61
53
  "kind": "code",
62
- "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```"
54
+ "text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { elevate } from '@wix/sdk/context';\n\nawait elevate(publisher.publish)({ name: 'my-channel' }, { message: 'hello' });\n```"
63
55
  }
64
56
  ]
65
57
  },
@@ -68,11 +60,11 @@
68
60
  "content": [
69
61
  {
70
62
  "kind": "text",
71
- "text": "Contextual client (Wix-hosted)\n"
63
+ "text": "Publish a message to the specified channel: Self-hosted\n"
72
64
  },
73
65
  {
74
66
  "kind": "code",
75
- "text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { elevate } from '@wix/sdk/context';\n\nawait elevate(publisher.publish)({ name: 'my-channel' }, { message: 'hello' });\n```"
67
+ "text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { createClient } from '@wix/sdk';\n\n// Import the auth strategy for the relevant access type\n// Import the relevant host module if needed\n\nconst client = createClient({\n modules: { publisher },\n // Include the auth strategy and host as relevant\n});\n\nawait client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });\n```"
76
68
  }
77
69
  ]
78
70
  }
@@ -89,7 +81,7 @@
89
81
  "summary": [
90
82
  {
91
83
  "kind": "text",
92
- "text": "Channel, and optionally resource, to publish to."
84
+ "text": "Channel or resource to publish to."
93
85
  }
94
86
  ]
95
87
  },
@@ -161,15 +153,7 @@
161
153
  "summary": [
162
154
  {
163
155
  "kind": "text",
164
- "text": "Publishes a message to a channel or channel resource.\n\nAll subscribers currently listening to the specified channel receive the\nmessage. Subscribers to a channel don't receive messages published to a\nresource on that channel, and vice versa.\n\nThis method is backend-only and requires elevated permissions.\n\n<!-- TODO: Check whether this API is relevant for headless projects. -->\n\n> **Note:** This function requires elevated permissions and runs only on the backend.\n> You can also call this method from the frontend using "
165
- },
166
- {
167
- "kind": "code",
168
- "text": "`elevate()`"
169
- },
170
- {
171
- "kind": "text",
172
- "text": ".\n> Elevated permissions are only available for apps and service accounts."
156
+ "text": "Publishes a message to a channel or resource.\n\nThe method publishes a message to all subscriptions on the specified channel or resource. Channels and resources are isolated, so subscribers to a channel don't receive messages published to a resource. Similarly, subscribers to a resource don't receive messages published to the parent channel.\n\n> **Authentication**\n>\n> This method may require higher-level permissions than the caller has, based on their [identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities) and [roles and permissions](https://support.wix.com/en/article/roles-permissions-overview). In these cases, you can ensure the method is called with the required level of authorization by using [elevated permissions](https://dev.wix.com/docs/api-reference/articles/authentication/about-elevated-permissions).\n\n<!-- TODO: Check whether this API is relevant for headless projects. -->"
173
157
  }
174
158
  ],
175
159
  "blockTags": [
@@ -178,11 +162,11 @@
178
162
  "content": [
179
163
  {
180
164
  "kind": "text",
181
- "text": "Manual client (self-hosted / explicit auth)\n"
165
+ "text": "Publish a message to the specified channel\n"
182
166
  },
183
167
  {
184
168
  "kind": "code",
185
- "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```"
169
+ "text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { elevate } from '@wix/sdk/context';\n\nawait elevate(publisher.publish)({ name: 'my-channel' }, { message: 'hello' });\n```"
186
170
  }
187
171
  ]
188
172
  },
@@ -191,11 +175,11 @@
191
175
  "content": [
192
176
  {
193
177
  "kind": "text",
194
- "text": "Contextual client (Wix-hosted)\n"
178
+ "text": "Publish a message to the specified channel: Self-hosted\n"
195
179
  },
196
180
  {
197
181
  "kind": "code",
198
- "text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { elevate } from '@wix/sdk/context';\n\nawait elevate(publisher.publish)({ name: 'my-channel' }, { message: 'hello' });\n```"
182
+ "text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { createClient } from '@wix/sdk';\n\n// Import the auth strategy for the relevant access type\n// Import the relevant host module if needed\n\nconst client = createClient({\n modules: { publisher },\n // Include the auth strategy and host as relevant\n});\n\nawait client.publisher.publish({ name: 'my-channel' }, { message: 'hello' });\n```"
199
183
  }
200
184
  ]
201
185
  }
@@ -265,15 +249,7 @@
265
249
  "summary": [
266
250
  {
267
251
  "kind": "text",
268
- "text": "Manages subscriber permissions on channels.\n\nUse the permissions router to define which subscribers can receive messages\non specific channels or channel resources. The router allows you to set permissions at the\nchannel level and the channel resource level. If you don't define\npermissions for a particular resource, it inherits the permissions of its\nparent channel.\n\nTypically, you use the permissions router in the **realtime-permissions.js**\nfile in your site's backend to:\n\n+ Set default permissions for all channels where no explicit permissions\n are defined.\n+ Add permissions logic for specific channels or channel resources.\n+ Check the permissions for a subscriber on a channel.\n\n> **Note:** You don't have to use the permissions router. You can also\n> define all your permissions logic directly in the\n> "
269
- },
270
- {
271
- "kind": "code",
272
- "text": "`realtime_check_permission()`"
273
- },
274
- {
275
- "kind": "text",
276
- "text": " function."
252
+ "text": "Realtime permissions router.\n\nDefines which subscribers can receive messages on specific channels or resources. Learn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
277
253
  }
278
254
  ]
279
255
  },
@@ -295,23 +271,7 @@
295
271
  "summary": [
296
272
  {
297
273
  "kind": "text",
298
- "text": "Sets a permissions handler for a specific channel or channel resource.\n\nAdding a handler to a channel without specifying a resource applies the\nhandler to the channel itself and to any of its resources that don't have\ntheir own handler.\n\nFor example, given the following setup:\n\n+ channel: A, permissions: handler X (set with "
299
- },
300
- {
301
- "kind": "code",
302
- "text": "`add()`"
303
- },
304
- {
305
- "kind": "text",
306
- "text": ")\n+ channel: A, resource: 1, permissions: handler Y (set with "
307
- },
308
- {
309
- "kind": "code",
310
- "text": "`add()`"
311
- },
312
- {
313
- "kind": "text",
314
- "text": ")\n+ channel: A, resource: 2, permissions: no handler\n\nPermissions are checked as follows:\n\n+ A: handler X\n+ A, resource 1: handler Y\n+ A, resource 2: handler X (inherited from channel)"
274
+ "text": "Sets a permissions handler for a specific channel or resource.\n\nAdding a handler to a channel without specifying a resource applies the handler to the channel and to any of its resources that don't have their own handler. Learn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
315
275
  }
316
276
  ],
317
277
  "blockTags": [
@@ -364,7 +324,7 @@
364
324
  "summary": [
365
325
  {
366
326
  "kind": "text",
367
- "text": "Channel or channel resource to set a permissions handler for."
327
+ "text": "Channel or resource to set a permissions handler for."
368
328
  }
369
329
  ]
370
330
  },
@@ -385,7 +345,7 @@
385
345
  "summary": [
386
346
  {
387
347
  "kind": "text",
388
- "text": "Function to run when checking permissions for the specified channel."
348
+ "text": "Handler to run when checking permissions for the specified channel."
389
349
  }
390
350
  ]
391
351
  },
@@ -441,27 +401,7 @@
441
401
  "summary": [
442
402
  {
443
403
  "kind": "text",
444
- "text": "Checks the permissions for a subscriber on a channel or channel resource.\n\nThe resolution chain is:\n\n1. If a handler exists for the specified channel or resource, it runs and\n its result is returned.\n1. If no handler exists for the resource, the parent channel's handler\n runs instead.\n1. If no channel handler exists, the default handler runs.\n1. If no default handler is set, the built-in default permissions are\n returned: "
445
- },
446
- {
447
- "kind": "code",
448
- "text": "`{\"read\": true}`"
449
- },
450
- {
451
- "kind": "text",
452
- "text": ".\n\nTypically, call this method in the body of the "
453
- },
454
- {
455
- "kind": "code",
456
- "text": "`realtime_check_permission()`"
457
- },
458
- {
459
- "kind": "text",
460
- "text": "\nfunction:\n\n"
461
- },
462
- {
463
- "kind": "code",
464
- "text": "```JavaScript\nexport function realtime_check_permission(channel, subscriber) {\n return permissionsRouter.check(channel, subscriber);\n}\n```"
404
+ "text": "Checks permissions for a subscriber on a channel or resource.\n\nRuns the appropriate permissions handler to check whether the subscriber can receive messages on the specified channel or resource.\n\nLearn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
465
405
  }
466
406
  ],
467
407
  "blockTags": [
@@ -506,7 +446,7 @@
506
446
  "content": [
507
447
  {
508
448
  "kind": "text",
509
- "text": "The permissions granted to the subscriber."
449
+ "text": "Permissions granted to the subscriber for the specified channel or resource."
510
450
  }
511
451
  ]
512
452
  },
@@ -541,7 +481,7 @@
541
481
  "summary": [
542
482
  {
543
483
  "kind": "text",
544
- "text": "Channel or channel resource to check permissions for."
484
+ "text": "Channel or resource to check permissions for."
545
485
  }
546
486
  ]
547
487
  },
@@ -622,39 +562,7 @@
622
562
  "summary": [
623
563
  {
624
564
  "kind": "text",
625
- "text": "Sets the default permissions handler.\n\nThe default handler runs for all channels and resources where no explicit\nhandler has been added with "
626
- },
627
- {
628
- "kind": "code",
629
- "text": "`add()`"
630
- },
631
- {
632
- "kind": "text",
633
- "text": ". Resources without their own handler\ninherit the parent channel's handler before falling back to the default.\n\nFor example, given the following setup:\n\n+ channel: A, permissions: no handler\n+ channel: A, resource: 1, permissions: no handler\n+ channel: A, resource: 2, permissions: handler set with "
634
- },
635
- {
636
- "kind": "code",
637
- "text": "`add()`"
638
- },
639
- {
640
- "kind": "text",
641
- "text": "\n\nPermissions are checked as follows:\n\n+ A: default handler\n+ A, resource 1: default handler\n+ A, resource 2: handler set with "
642
- },
643
- {
644
- "kind": "code",
645
- "text": "`add()`"
646
- },
647
- {
648
- "kind": "text",
649
- "text": "\n\nIf no default handler is set, the built-in default permissions are used:\n"
650
- },
651
- {
652
- "kind": "code",
653
- "text": "`{\"read\": true}`"
654
- },
655
- {
656
- "kind": "text",
657
- "text": "."
565
+ "text": "Sets the default permissions handler.\n\nThe default handler runs when the specified channel or resource doesn't have an explicit handler. Learn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
658
566
  }
659
567
  ],
660
568
  "blockTags": [
@@ -689,7 +597,7 @@
689
597
  "summary": [
690
598
  {
691
599
  "kind": "text",
692
- "text": "Function to run when checking default permissions."
600
+ "text": "Handler to run when checking default permissions."
693
601
  }
694
602
  ]
695
603
  },
@@ -745,7 +653,7 @@
745
653
  "summary": [
746
654
  {
747
655
  "kind": "text",
748
- "text": "A function that determines the permissions for a subscriber on a channel\nor channel resource. Return a "
656
+ "text": "Determines the permissions for a subscriber on a channel or resource. Return a "
749
657
  },
750
658
  {
751
659
  "kind": "code",
@@ -753,7 +661,7 @@
753
661
  },
754
662
  {
755
663
  "kind": "text",
756
- "text": " object to grant or deny\naccess."
664
+ "text": " object to grant or deny access."
757
665
  }
758
666
  ],
759
667
  "blockTags": [
@@ -824,7 +732,7 @@
824
732
  "summary": [
825
733
  {
826
734
  "kind": "text",
827
- "text": "Channel or channel resource being checked."
735
+ "text": "Channel or resource being checked."
828
736
  }
829
737
  ]
830
738
  },
@@ -907,23 +815,7 @@
907
815
  "summary": [
908
816
  {
909
817
  "kind": "text",
910
- "text": "Sets a permissions handler for a specific channel or channel resource.\n\nAdding a handler to a channel without specifying a resource applies the\nhandler to the channel itself and to any of its resources that don't have\ntheir own handler.\n\nFor example, given the following setup:\n\n+ channel: A, permissions: handler X (set with "
911
- },
912
- {
913
- "kind": "code",
914
- "text": "`add()`"
915
- },
916
- {
917
- "kind": "text",
918
- "text": ")\n+ channel: A, resource: 1, permissions: handler Y (set with "
919
- },
920
- {
921
- "kind": "code",
922
- "text": "`add()`"
923
- },
924
- {
925
- "kind": "text",
926
- "text": ")\n+ channel: A, resource: 2, permissions: no handler\n\nPermissions are checked as follows:\n\n+ A: handler X\n+ A, resource 1: handler Y\n+ A, resource 2: handler X (inherited from channel)"
818
+ "text": "Sets a permissions handler for a specific channel or resource.\n\nAdding a handler to a channel without specifying a resource adds the handler to the channel and to all resources that don't have their own handler. Learn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
927
819
  }
928
820
  ],
929
821
  "blockTags": [
@@ -976,7 +868,7 @@
976
868
  "summary": [
977
869
  {
978
870
  "kind": "text",
979
- "text": "Channel or channel resource to set a permissions handler for."
871
+ "text": "Channel or resource to set a permissions handler for."
980
872
  }
981
873
  ]
982
874
  },
@@ -997,7 +889,7 @@
997
889
  "summary": [
998
890
  {
999
891
  "kind": "text",
1000
- "text": "Function to run when checking permissions for the specified channel."
892
+ "text": "Handler to run when checking permissions for the specified channel."
1001
893
  }
1002
894
  ]
1003
895
  },
@@ -1044,27 +936,7 @@
1044
936
  "summary": [
1045
937
  {
1046
938
  "kind": "text",
1047
- "text": "Checks the permissions for a subscriber on a channel or channel resource.\n\nThe resolution chain is:\n\n1. If a handler exists for the specified channel or resource, it runs and\n its result is returned.\n1. If no handler exists for the resource, the parent channel's handler\n runs instead.\n1. If no channel handler exists, the default handler runs.\n1. If no default handler is set, the built-in default permissions are\n returned: "
1048
- },
1049
- {
1050
- "kind": "code",
1051
- "text": "`{\"read\": true}`"
1052
- },
1053
- {
1054
- "kind": "text",
1055
- "text": ".\n\nTypically, call this method in the body of the "
1056
- },
1057
- {
1058
- "kind": "code",
1059
- "text": "`realtime_check_permission()`"
1060
- },
1061
- {
1062
- "kind": "text",
1063
- "text": "\nfunction:\n\n"
1064
- },
1065
- {
1066
- "kind": "code",
1067
- "text": "```JavaScript\nexport function realtime_check_permission(channel, subscriber) {\n return permissionsRouter.check(channel, subscriber);\n}\n```"
939
+ "text": "Checks permissions for a subscriber on a channel or resource.\n\nRuns the permissions handler appropriate for the subscriber on the specified channel or resource.\n\nLearn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
1068
940
  }
1069
941
  ],
1070
942
  "blockTags": [
@@ -1109,7 +981,7 @@
1109
981
  "content": [
1110
982
  {
1111
983
  "kind": "text",
1112
- "text": "The permissions granted to the subscriber."
984
+ "text": "Permissions granted to the subscriber for the specified channel or resource."
1113
985
  }
1114
986
  ]
1115
987
  },
@@ -1144,7 +1016,7 @@
1144
1016
  "summary": [
1145
1017
  {
1146
1018
  "kind": "text",
1147
- "text": "Channel or channel resource to check permissions for."
1019
+ "text": "Channel or resource to check permissions for."
1148
1020
  }
1149
1021
  ]
1150
1022
  },
@@ -1214,39 +1086,7 @@
1214
1086
  "summary": [
1215
1087
  {
1216
1088
  "kind": "text",
1217
- "text": "Sets the default permissions handler.\n\nThe default handler runs for all channels and resources where no explicit\nhandler has been added with "
1218
- },
1219
- {
1220
- "kind": "code",
1221
- "text": "`add()`"
1222
- },
1223
- {
1224
- "kind": "text",
1225
- "text": ". Resources without their own handler\ninherit the parent channel's handler before falling back to the default.\n\nFor example, given the following setup:\n\n+ channel: A, permissions: no handler\n+ channel: A, resource: 1, permissions: no handler\n+ channel: A, resource: 2, permissions: handler set with "
1226
- },
1227
- {
1228
- "kind": "code",
1229
- "text": "`add()`"
1230
- },
1231
- {
1232
- "kind": "text",
1233
- "text": "\n\nPermissions are checked as follows:\n\n+ A: default handler\n+ A, resource 1: default handler\n+ A, resource 2: handler set with "
1234
- },
1235
- {
1236
- "kind": "code",
1237
- "text": "`add()`"
1238
- },
1239
- {
1240
- "kind": "text",
1241
- "text": "\n\nIf no default handler is set, the built-in default permissions are used:\n"
1242
- },
1243
- {
1244
- "kind": "code",
1245
- "text": "`{\"read\": true}`"
1246
- },
1247
- {
1248
- "kind": "text",
1249
- "text": "."
1089
+ "text": "Sets the default permissions handler.\n\nThe default handler runs when the specified channel or resource doesn't have an explicit handler.\n\nLearn more about [permission resolution](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
1250
1090
  }
1251
1091
  ],
1252
1092
  "blockTags": [
@@ -1281,7 +1121,7 @@
1281
1121
  "summary": [
1282
1122
  {
1283
1123
  "kind": "text",
1284
- "text": "Function to run when checking default permissions."
1124
+ "text": "Default handler to run when checking permissions."
1285
1125
  }
1286
1126
  ]
1287
1127
  },
@@ -1334,7 +1174,7 @@
1334
1174
  "summary": [
1335
1175
  {
1336
1176
  "kind": "text",
1337
- "text": "A realtime channel that subscribers can listen to and publishers can send messages to.\nA channel can optionally contain resources, which act as isolated sub-channels.\nSubscribing to a channel doesn't include messages published to its resources, and vice versa."
1177
+ "text": "Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them."
1338
1178
  }
1339
1179
  ]
1340
1180
  },
@@ -1349,7 +1189,7 @@
1349
1189
  "summary": [
1350
1190
  {
1351
1191
  "kind": "text",
1352
- "text": "Channel name. Supports alphanumeric characters, hyphens, and underscores.\nThe combined length of "
1192
+ "text": "Channel name.\n\n> **Notes:**\n> - Supports only alphanumeric characters, hyphens, and underscores.\n> - The combined length of "
1353
1193
  },
1354
1194
  {
1355
1195
  "kind": "code",
@@ -1386,15 +1226,7 @@
1386
1226
  "summary": [
1387
1227
  {
1388
1228
  "kind": "text",
1389
- "text": "Resource ID within the channel. Use resources to isolate messages within a channel.\nFor example, a "
1390
- },
1391
- {
1392
- "kind": "code",
1393
- "text": "`chat`"
1394
- },
1395
- {
1396
- "kind": "text",
1397
- "text": " channel might use a separate resource for each chat room."
1229
+ "text": "Resource ID.\n\nResources are isolated sub-channels in a channel. A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa."
1398
1230
  }
1399
1231
  ]
1400
1232
  },
@@ -1424,7 +1256,7 @@
1424
1256
  "summary": [
1425
1257
  {
1426
1258
  "kind": "text",
1427
- "text": "Permission settings for a subscriber on a channel or channel resource."
1259
+ "text": "Permissions for a subscriber on a channel or resource."
1428
1260
  }
1429
1261
  ]
1430
1262
  },
@@ -1446,6 +1278,10 @@
1446
1278
  {
1447
1279
  "kind": "code",
1448
1280
  "text": "`true`"
1281
+ },
1282
+ {
1283
+ "kind": "text",
1284
+ "text": "."
1449
1285
  }
1450
1286
  ]
1451
1287
  },
@@ -1553,15 +1389,7 @@
1553
1389
  "summary": [
1554
1390
  {
1555
1391
  "kind": "text",
1556
- "text": "A channel subscriber whose permissions are being checked.\nPassed to the "
1557
- },
1558
- {
1559
- "kind": "code",
1560
- "text": "`realtime_check_permission()`"
1561
- },
1562
- {
1563
- "kind": "text",
1564
- "text": " hook to identify the subscriber."
1392
+ "text": "Subscriber to a channel or resource.\n\nWix checks [subscriber permissions](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/realtime-check-permission) before they can listen to messages."
1565
1393
  }
1566
1394
  ]
1567
1395
  },
@@ -1606,7 +1434,7 @@
1606
1434
  "summary": [
1607
1435
  {
1608
1436
  "kind": "text",
1609
- "text": "Subscriber type, based on their authentication status."
1437
+ "text": "Subscriber identity type.\n\nLearn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities)."
1610
1438
  }
1611
1439
  ],
1612
1440
  "blockTags": [
@@ -1654,15 +1482,7 @@
1654
1482
  "summary": [
1655
1483
  {
1656
1484
  "kind": "text",
1657
- "text": "The realtime permissions router.\n\nUse the permissions router to define which subscribers can receive messages\non specific channels or channel resources. You can set permissions at the\nchannel level and the channel resource level. If you don't define\npermissions for a particular resource, it inherits the permissions of its\nparent channel.\n\nTypically, you use the permissions router in the **realtime-permissions.js**\nfile in your site's backend to:\n\n+ Set default permissions for all channels where no explicit permissions\n are defined.\n+ Add permissions logic for specific channels or channel resources.\n+ Check the permissions for a subscriber on a channel.\n\n> **Note:** You don't have to use the permissions router. You can also\n> define all your permissions logic directly in the\n> "
1658
- },
1659
- {
1660
- "kind": "code",
1661
- "text": "`realtime_check_permission()`"
1662
- },
1663
- {
1664
- "kind": "text",
1665
- "text": " function."
1485
+ "text": "Realtime permissions router.\n\nDefines which subscribers can receive messages on specific channels or resources. Learn more about the [permissions router](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction)."
1666
1486
  }
1667
1487
  ],
1668
1488
  "blockTags": [
@@ -1701,7 +1521,39 @@
1701
1521
  "summary": [
1702
1522
  {
1703
1523
  "kind": "text",
1704
- "text": "Publishes a message to a channel or channel resource."
1524
+ "text": "Publishes a message to a channel or resource.\n\nSubscribers to a channel don't receive messages published to a resource on\nthat channel, and vice versa.\n\nTo publish a message to specific users only, specify the users by ID in\nthe "
1525
+ },
1526
+ {
1527
+ "kind": "code",
1528
+ "text": "`options`"
1529
+ },
1530
+ {
1531
+ "kind": "text",
1532
+ "text": " parameter. To include the publisher's identity in the message,\nset "
1533
+ },
1534
+ {
1535
+ "kind": "code",
1536
+ "text": "`includePublisher`"
1537
+ },
1538
+ {
1539
+ "kind": "text",
1540
+ "text": " to "
1541
+ },
1542
+ {
1543
+ "kind": "code",
1544
+ "text": "`true`"
1545
+ },
1546
+ {
1547
+ "kind": "text",
1548
+ "text": " in the "
1549
+ },
1550
+ {
1551
+ "kind": "code",
1552
+ "text": "`options`"
1553
+ },
1554
+ {
1555
+ "kind": "text",
1556
+ "text": " parameter."
1705
1557
  }
1706
1558
  ],
1707
1559
  "blockTags": [
@@ -1726,64 +1578,7 @@
1726
1578
  },
1727
1579
  {
1728
1580
  "kind": "text",
1729
- "text": " module instead.\n\nSubscribers to a channel don't receive messages published to a resource on\nthat channel, and vice versa.\n\nTo publish a message to specific users only, specify the users by ID in\nthe "
1730
- },
1731
- {
1732
- "kind": "code",
1733
- "text": "`options`"
1734
- },
1735
- {
1736
- "kind": "text",
1737
- "text": " parameter. To include the publisher's identity in the message,\nset "
1738
- },
1739
- {
1740
- "kind": "code",
1741
- "text": "`includePublisher`"
1742
- },
1743
- {
1744
- "kind": "text",
1745
- "text": " to "
1746
- },
1747
- {
1748
- "kind": "code",
1749
- "text": "`true`"
1750
- },
1751
- {
1752
- "kind": "text",
1753
- "text": " in the "
1754
- },
1755
- {
1756
- "kind": "code",
1757
- "text": "`options`"
1758
- },
1759
- {
1760
- "kind": "text",
1761
- "text": " parameter."
1762
- }
1763
- ]
1764
- },
1765
- {
1766
- "tag": "@deprecated",
1767
- "content": [
1768
- {
1769
- "kind": "text",
1770
- "text": "Use "
1771
- },
1772
- {
1773
- "kind": "code",
1774
- "text": "`publisher.publish`"
1775
- },
1776
- {
1777
- "kind": "text",
1778
- "text": " from "
1779
- },
1780
- {
1781
- "kind": "code",
1782
- "text": "`@wix/realtime`"
1783
- },
1784
- {
1785
- "kind": "text",
1786
- "text": " instead."
1581
+ "text": " module instead."
1787
1582
  }
1788
1583
  ]
1789
1584
  },
@@ -1828,7 +1623,7 @@
1828
1623
  "content": [
1829
1624
  {
1830
1625
  "kind": "text",
1831
- "text": "Fulfilled when the message is published. Doesn't indicate that the message was received by subscribers."
1626
+ "text": "Resolves when the message is published. Doesn't indicate that the message was received by subscribers."
1832
1627
  }
1833
1628
  ]
1834
1629
  }
@@ -1934,31 +1729,7 @@
1934
1729
  "summary": [
1935
1730
  {
1936
1731
  "kind": "text",
1937
- "text": "Checks permissions for a subscriber on a channel or channel resource.\n\nThis is a hook, not a method you call directly. Define this function as a\nnamed export in a file called **realtime-permissions.js** in your site's\nbackend. It runs automatically when a site visitor subscribes to a channel.\n\n> **Important:**\n> - If this function isn't defined, all subscribers receive the default\n> permissions: "
1938
- },
1939
- {
1940
- "kind": "code",
1941
- "text": "`{\"read\": true}`"
1942
- },
1943
- {
1944
- "kind": "text",
1945
- "text": ".\n> - In Wix Studio, you don't need to define this function, but you must\n> create a backend file named **realtime-permissions.js**. Without this\n> file, subscriptions fail.\n\nImplement permissions logic in one of the following ways:\n\n+ Include all permissions logic directly in the body of this function.\n+ Use the "
1946
- },
1947
- {
1948
- "kind": "code",
1949
- "text": "`permissionsRouter`"
1950
- },
1951
- {
1952
- "kind": "text",
1953
- "text": " to add permissions logic per channel, then\n call "
1954
- },
1955
- {
1956
- "kind": "code",
1957
- "text": "`permissionsRouter.check()`"
1958
- },
1959
- {
1960
- "kind": "text",
1961
- "text": " in the body of this function and return\n its result.\n\n> **Note:** When previewing your site, read permissions are always granted."
1732
+ "text": "Checks permissions for a subscriber on a channel or resource.\n\nThis hook runs automatically whenever a new subscription is attempted.\n\nSet up this hook as a named export in the **realtime-permissions.js** file in a site's backend.\n\nLearn more about [setting up permissions](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction#setting-up-permissions)."
1962
1733
  }
1963
1734
  ],
1964
1735
  "blockTags": [
@@ -2003,16 +1774,7 @@
2003
1774
  "content": [
2004
1775
  {
2005
1776
  "kind": "text",
2006
- "text": "The permissions granted to the subscriber on the channel or channel resource."
2007
- }
2008
- ]
2009
- },
2010
- {
2011
- "tag": "@servicePath",
2012
- "content": [
2013
- {
2014
- "kind": "text",
2015
- "text": "wix-realtime-backend.ChannelPermissions"
1777
+ "text": "Permissions granted to the subscriber for the specified channel or resource."
2016
1778
  }
2017
1779
  ]
2018
1780
  },
@@ -2038,7 +1800,7 @@
2038
1800
  "summary": [
2039
1801
  {
2040
1802
  "kind": "text",
2041
- "text": "Channel, and optionally resource, to check permissions for."
1803
+ "text": "Channel and resource to check permissions for."
2042
1804
  }
2043
1805
  ]
2044
1806
  },
@@ -2147,7 +1909,7 @@
2147
1909
  "summary": [
2148
1910
  {
2149
1911
  "kind": "text",
2150
- "text": "Subscribes to a channel or channel resource.\n\nThe method returns a subscription ID immediately. The connection is\nestablished asynchronously in the background. Use the "
1912
+ "text": "Subscribes to a channel or resource.\n\nThe method attempts to establish a subscription to the specified channel or resource. While the subscription is attempted asynchronously, the method returns the subscription ID immediately.\n\nUse the "
2151
1913
  },
2152
1914
  {
2153
1915
  "kind": "code",
@@ -2155,15 +1917,15 @@
2155
1917
  },
2156
1918
  {
2157
1919
  "kind": "text",
2158
- "text": " parameter\nto register lifecycle handlers that notify you when the subscription\nsucceeds or encounters an error.\n\nIf the connection drops, the client automatically attempts to reconnect\nand re-subscribe. The "
1920
+ "text": " parameter to register handlers that run whenever the subscription succeeds or generates an error. For some errors, the subscription is re-attempted automatically. The "
2159
1921
  },
2160
1922
  {
2161
1923
  "kind": "code",
2162
- "text": "`onSubscribed`"
1924
+ "text": "`onSubscribed()`"
2163
1925
  },
2164
1926
  {
2165
1927
  "kind": "text",
2166
- "text": " handler fires again on each\nsuccessful re-subscription."
1928
+ "text": " handler runs on every successful re-subscription."
2167
1929
  }
2168
1930
  ],
2169
1931
  "blockTags": [
@@ -2172,11 +1934,11 @@
2172
1934
  "content": [
2173
1935
  {
2174
1936
  "kind": "text",
2175
- "text": "Manual client (self-hosted / explicit auth)\n"
1937
+ "text": "Subscribe to a channel\n"
2176
1938
  },
2177
1939
  {
2178
1940
  "kind": "code",
2179
- "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```"
1941
+ "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```"
2180
1942
  }
2181
1943
  ]
2182
1944
  },
@@ -2185,11 +1947,11 @@
2185
1947
  "content": [
2186
1948
  {
2187
1949
  "kind": "text",
2188
- "text": "Contextual client (Wix-hosted)\n"
1950
+ "text": "Subscribe to a channel: Self-hosted\n"
2189
1951
  },
2190
1952
  {
2191
1953
  "kind": "code",
2192
- "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```"
1954
+ "text": "```ts\nimport { createClient } from '@wix/sdk';\nimport { subscriber } from '@wix/realtime';\n\n// Import the auth strategy for the relevant access type\n// Import the relevant host module if needed\n\nconst client = createClient({\n modules: { subscriber },\n // Include the auth strategy and host as relevant\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```"
2193
1955
  }
2194
1956
  ]
2195
1957
  }
@@ -2277,7 +2039,7 @@
2277
2039
  "summary": [
2278
2040
  {
2279
2041
  "kind": "text",
2280
- "text": "Subscribes to a channel or channel resource.\n\nThe method returns a subscription ID immediately. The connection is\nestablished asynchronously in the background. Use the "
2042
+ "text": "Subscribes to a channel or resource.\n\nThe method attempts to establish a subscription to the specified channel or resource. While the subscription is attempted asynchronously, the method returns the subscription ID immediately.\n\nUse the "
2281
2043
  },
2282
2044
  {
2283
2045
  "kind": "code",
@@ -2285,15 +2047,15 @@
2285
2047
  },
2286
2048
  {
2287
2049
  "kind": "text",
2288
- "text": " parameter\nto register lifecycle handlers that notify you when the subscription\nsucceeds or encounters an error.\n\nIf the connection drops, the client automatically attempts to reconnect\nand re-subscribe. The "
2050
+ "text": " parameter to register handlers that run whenever the subscription succeeds or generates an error. For some errors, the subscription is re-attempted automatically. The "
2289
2051
  },
2290
2052
  {
2291
2053
  "kind": "code",
2292
- "text": "`onSubscribed`"
2054
+ "text": "`onSubscribed()`"
2293
2055
  },
2294
2056
  {
2295
2057
  "kind": "text",
2296
- "text": " handler fires again on each\nsuccessful re-subscription."
2058
+ "text": " handler runs on every successful re-subscription."
2297
2059
  }
2298
2060
  ],
2299
2061
  "blockTags": [
@@ -2302,11 +2064,11 @@
2302
2064
  "content": [
2303
2065
  {
2304
2066
  "kind": "text",
2305
- "text": "Manual client (self-hosted / explicit auth)\n"
2067
+ "text": "Subscribe to a channel\n"
2306
2068
  },
2307
2069
  {
2308
2070
  "kind": "code",
2309
- "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```"
2071
+ "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```"
2310
2072
  }
2311
2073
  ]
2312
2074
  },
@@ -2315,11 +2077,11 @@
2315
2077
  "content": [
2316
2078
  {
2317
2079
  "kind": "text",
2318
- "text": "Contextual client (Wix-hosted)\n"
2080
+ "text": "Subscribe to a channel: Self-hosted\n"
2319
2081
  },
2320
2082
  {
2321
2083
  "kind": "code",
2322
- "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```"
2084
+ "text": "```ts\nimport { createClient } from '@wix/sdk';\nimport { subscriber } from '@wix/realtime';\n\n// Import the auth strategy for the relevant access type\n// Import the relevant host module if needed\n\nconst client = createClient({\n modules: { subscriber },\n // Include the auth strategy and host as relevant\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```"
2323
2085
  }
2324
2086
  ]
2325
2087
  }
@@ -2372,7 +2134,7 @@
2372
2134
  "summary": [
2373
2135
  {
2374
2136
  "kind": "text",
2375
- "text": "Removes one or more subscriptions.\n\nYou can unsubscribe in three ways:\n- By "
2137
+ "text": "Removes 1 or more subscriptions.\n\nYou can unsubscribe in 3 ways:\n- By "
2376
2138
  },
2377
2139
  {
2378
2140
  "kind": "code",
@@ -2388,7 +2150,7 @@
2388
2150
  },
2389
2151
  {
2390
2152
  "kind": "text",
2391
- "text": ": removes all subscriptions to that channel or channel resource.\n- By both: removes the specific subscription, verifying it matches the channel.\n\nWhen the last subscription on a connection is removed, the connection\ncloses automatically."
2153
+ "text": ": removes all subscriptions to that channel or resource.\n- By both: removes the specific subscription, verifying it matches the channel.\n\nWhen the last subscription on a connection is removed, the connection\ncloses automatically."
2392
2154
  }
2393
2155
  ],
2394
2156
  "blockTags": [
@@ -2397,11 +2159,11 @@
2397
2159
  "content": [
2398
2160
  {
2399
2161
  "kind": "text",
2400
- "text": "Manual client (self-hosted / explicit auth)\n"
2162
+ "text": "Remove the specified subscription.\n"
2401
2163
  },
2402
2164
  {
2403
2165
  "kind": "code",
2404
- "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```"
2166
+ "text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nsubscriber.unsubscribe({ subscriptionId });\n```"
2405
2167
  }
2406
2168
  ]
2407
2169
  },
@@ -2410,11 +2172,11 @@
2410
2172
  "content": [
2411
2173
  {
2412
2174
  "kind": "text",
2413
- "text": "Contextual client (Wix-hosted)\n"
2175
+ "text": "Remove the specified subscription: Self-hosted\n"
2414
2176
  },
2415
2177
  {
2416
2178
  "kind": "code",
2417
- "text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nsubscriber.unsubscribe({ subscriptionId });\n```"
2179
+ "text": "```ts\nimport { subscriber } from '@wix/realtime';\nimport { createClient } from '@wix/sdk';\n\n// Import the auth strategy for the relevant access type\n// Import the relevant host module if needed\n\nconst client = createClient({\n modules: { subscriber },\n // Include the auth strategy and host as relevant\n});\n\n// Remove the specified subscription\nclient.subscriber.unsubscribe({ subscriptionId });\n\n// Remove all subscriptions from the specified channel\nclient.subscriber.unsubscribe({ channel: { name: 'my-channel' } });\n```"
2418
2180
  }
2419
2181
  ]
2420
2182
  }
@@ -2431,7 +2193,7 @@
2431
2193
  "summary": [
2432
2194
  {
2433
2195
  "kind": "text",
2434
- "text": "Specifies what to unsubscribe from. At least one of "
2196
+ "text": "Unsubscribe information. You must specify "
2435
2197
  },
2436
2198
  {
2437
2199
  "kind": "code",
@@ -2439,7 +2201,7 @@
2439
2201
  },
2440
2202
  {
2441
2203
  "kind": "text",
2442
- "text": " or "
2204
+ "text": ", "
2443
2205
  },
2444
2206
  {
2445
2207
  "kind": "code",
@@ -2447,7 +2209,7 @@
2447
2209
  },
2448
2210
  {
2449
2211
  "kind": "text",
2450
- "text": " is required."
2212
+ "text": ", or both."
2451
2213
  }
2452
2214
  ]
2453
2215
  },
@@ -2474,7 +2236,7 @@
2474
2236
  "summary": [
2475
2237
  {
2476
2238
  "kind": "text",
2477
- "text": "Removes one or more subscriptions.\n\nYou can unsubscribe in three ways:\n- By "
2239
+ "text": "Removes 1 or more subscriptions.\n\nYou can unsubscribe in 3 ways:\n- By "
2478
2240
  },
2479
2241
  {
2480
2242
  "kind": "code",
@@ -2490,7 +2252,7 @@
2490
2252
  },
2491
2253
  {
2492
2254
  "kind": "text",
2493
- "text": ": removes all subscriptions to that channel or channel resource.\n- By both: removes the specific subscription, verifying it matches the channel.\n\nWhen the last subscription on a connection is removed, the connection\ncloses automatically."
2255
+ "text": ": removes all subscriptions to that channel or resource.\n- By both: removes the specific subscription, verifying it matches the channel.\n\nWhen the last subscription on a connection is removed, the connection\ncloses automatically."
2494
2256
  }
2495
2257
  ],
2496
2258
  "blockTags": [
@@ -2499,11 +2261,11 @@
2499
2261
  "content": [
2500
2262
  {
2501
2263
  "kind": "text",
2502
- "text": "Manual client (self-hosted / explicit auth)\n"
2264
+ "text": "Remove the specified subscription.\n"
2503
2265
  },
2504
2266
  {
2505
2267
  "kind": "code",
2506
- "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```"
2268
+ "text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nsubscriber.unsubscribe({ subscriptionId });\n```"
2507
2269
  }
2508
2270
  ]
2509
2271
  },
@@ -2512,11 +2274,11 @@
2512
2274
  "content": [
2513
2275
  {
2514
2276
  "kind": "text",
2515
- "text": "Contextual client (Wix-hosted)\n"
2277
+ "text": "Remove the specified subscription: Self-hosted\n"
2516
2278
  },
2517
2279
  {
2518
2280
  "kind": "code",
2519
- "text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nsubscriber.unsubscribe({ subscriptionId });\n```"
2281
+ "text": "```ts\nimport { subscriber } from '@wix/realtime';\nimport { createClient } from '@wix/sdk';\n\n// Import the auth strategy for the relevant access type\n// Import the relevant host module if needed\n\nconst client = createClient({\n modules: { subscriber },\n // Include the auth strategy and host as relevant\n});\n\n// Remove the specified subscription\nclient.subscriber.unsubscribe({ subscriptionId });\n\n// Remove all subscriptions from the specified channel\nclient.subscriber.unsubscribe({ channel: { name: 'my-channel' } });\n```"
2520
2282
  }
2521
2283
  ]
2522
2284
  }
@@ -2573,7 +2335,7 @@
2573
2335
  "summary": [
2574
2336
  {
2575
2337
  "kind": "text",
2576
- "text": "Error codes for realtime errors."
2338
+ "text": "Error codes."
2577
2339
  }
2578
2340
  ]
2579
2341
  },
@@ -2588,7 +2350,7 @@
2588
2350
  "summary": [
2589
2351
  {
2590
2352
  "kind": "text",
2591
- "text": "The input is invalid. For example, a channel name with unsupported characters."
2353
+ "text": "Invalid input such as a channel name with unsupported characters."
2592
2354
  }
2593
2355
  ]
2594
2356
  },
@@ -2607,7 +2369,7 @@
2607
2369
  "summary": [
2608
2370
  {
2609
2371
  "kind": "text",
2610
- "text": "A connection attempt failed. The client keeps retrying automatically with exponential backoff."
2372
+ "text": "Connection attempt failed. Wix automatically attempts to establish the subscription."
2611
2373
  }
2612
2374
  ]
2613
2375
  },
@@ -2626,11 +2388,11 @@
2626
2388
  "summary": [
2627
2389
  {
2628
2390
  "kind": "text",
2629
- "text": "The connection was closed, either intentionally or due to an error. Check "
2391
+ "text": "Connection closed intentionally or due to an error. Check "
2630
2392
  },
2631
2393
  {
2632
2394
  "kind": "code",
2633
- "text": "`recoverable`"
2395
+ "text": "`error.recoverable`"
2634
2396
  },
2635
2397
  {
2636
2398
  "kind": "text",
@@ -2653,7 +2415,7 @@
2653
2415
  "summary": [
2654
2416
  {
2655
2417
  "kind": "text",
2656
- "text": "The subscription request was rejected by the server. For example, due to an authorization failure. This error is non-recoverable."
2418
+ "text": "Subscription request rejected, for example, due to an authorization failure. This error is non-recoverable."
2657
2419
  }
2658
2420
  ]
2659
2421
  },
@@ -2685,7 +2447,7 @@
2685
2447
  "summary": [
2686
2448
  {
2687
2449
  "kind": "text",
2688
- "text": "An error related to a realtime subscription or connection."
2450
+ "text": "Error thrown by a subscription or connection."
2689
2451
  }
2690
2452
  ]
2691
2453
  },
@@ -2832,7 +2594,7 @@
2832
2594
  "summary": [
2833
2595
  {
2834
2596
  "kind": "text",
2835
- "text": "Channel related to the error, if applicable."
2597
+ "text": "Channel that caused the error."
2836
2598
  }
2837
2599
  ]
2838
2600
  },
@@ -2853,7 +2615,7 @@
2853
2615
  "summary": [
2854
2616
  {
2855
2617
  "kind": "text",
2856
- "text": "Error code indicating the type of error."
2618
+ "text": "Error code."
2857
2619
  }
2858
2620
  ]
2859
2621
  },
@@ -2876,7 +2638,7 @@
2876
2638
  "summary": [
2877
2639
  {
2878
2640
  "kind": "text",
2879
- "text": "Whether the error is recoverable. When "
2641
+ "text": "Whether the error is automatically recoverable.\n\nWhen "
2880
2642
  },
2881
2643
  {
2882
2644
  "kind": "code",
@@ -2884,7 +2646,7 @@
2884
2646
  },
2885
2647
  {
2886
2648
  "kind": "text",
2887
- "text": ", the client is\nautomatically attempting to reconnect. When "
2649
+ "text": ", the client automatically attempts to reconnect. When "
2888
2650
  },
2889
2651
  {
2890
2652
  "kind": "code",
@@ -2892,11 +2654,15 @@
2892
2654
  },
2893
2655
  {
2894
2656
  "kind": "text",
2895
- "text": ", the subscription\nmust be re-created manually.\n\nDefault: "
2657
+ "text": ", you must attempt to re-subscribe manually.\n\nDefault: "
2896
2658
  },
2897
2659
  {
2898
2660
  "kind": "code",
2899
2661
  "text": "`false`"
2662
+ },
2663
+ {
2664
+ "kind": "text",
2665
+ "text": "."
2900
2666
  }
2901
2667
  ]
2902
2668
  },
@@ -2917,31 +2683,7 @@
2917
2683
  "summary": [
2918
2684
  {
2919
2685
  "kind": "text",
2920
- "text": "HTTP status code from the server response. For example, "
2921
- },
2922
- {
2923
- "kind": "code",
2924
- "text": "`401`"
2925
- },
2926
- {
2927
- "kind": "text",
2928
- "text": ", "
2929
- },
2930
- {
2931
- "kind": "code",
2932
- "text": "`403`"
2933
- },
2934
- {
2935
- "kind": "text",
2936
- "text": ", or "
2937
- },
2938
- {
2939
- "kind": "code",
2940
- "text": "`500`"
2941
- },
2942
- {
2943
- "kind": "text",
2944
- "text": ".\n\nReturned only when "
2686
+ "text": "[HTTP status code](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/troubleshooting/about-errors#http-status-codes).\n\nReturned only when "
2945
2687
  },
2946
2688
  {
2947
2689
  "kind": "code",
@@ -3006,7 +2748,7 @@
3006
2748
  "summary": [
3007
2749
  {
3008
2750
  "kind": "text",
3009
- "text": "A message received on a realtime channel."
2751
+ "text": "Message received on a channel."
3010
2752
  }
3011
2753
  ]
3012
2754
  },
@@ -3021,7 +2763,7 @@
3021
2763
  "summary": [
3022
2764
  {
3023
2765
  "kind": "text",
3024
- "text": "Message payload containing the published data.\n\nMax: 10 KB."
2766
+ "text": "Message payload that contains the published data.\n\nMax: 10 KB."
3025
2767
  }
3026
2768
  ]
3027
2769
  },
@@ -3057,7 +2799,7 @@
3057
2799
  "summary": [
3058
2800
  {
3059
2801
  "kind": "text",
3060
- "text": "Information about the user who published the message.\n\nReturned only when the publisher's identity is available."
2802
+ "text": "Publisher details.\n\nReturned only when the publisher's identity is available."
3061
2803
  }
3062
2804
  ]
3063
2805
  },
@@ -3089,7 +2831,7 @@
3089
2831
  "summary": [
3090
2832
  {
3091
2833
  "kind": "text",
3092
- "text": "Information about the user who published a message."
2834
+ "text": "Publisher details."
3093
2835
  }
3094
2836
  ]
3095
2837
  },
@@ -3133,7 +2875,7 @@
3133
2875
  "summary": [
3134
2876
  {
3135
2877
  "kind": "text",
3136
- "text": "Optional lifecycle handlers for a subscription. Use these to respond to\nsubscription status changes, such as successful connections and errors."
2878
+ "text": "Subscription status handlers that run whenever a subscription is established, re-established, or fails."
3137
2879
  }
3138
2880
  ]
3139
2881
  },
@@ -3150,7 +2892,7 @@
3150
2892
  "summary": [
3151
2893
  {
3152
2894
  "kind": "text",
3153
- "text": "Called when the subscription is successfully established.\n\nThis handler fires on the initial subscription and again every time the\nsubscription is automatically restored after a reconnection. Make\nsure your handler is idempotent.\n\nThe "
2895
+ "text": "Runs whenever the subscription is successfully established or re-established after a prior failure. To avoid unnecessary actions, make the handler idempotent.\n\nThe "
3154
2896
  },
3155
2897
  {
3156
2898
  "kind": "code",
@@ -3158,31 +2900,7 @@
3158
2900
  },
3159
2901
  {
3160
2902
  "kind": "text",
3161
- "text": " parameter indicates whether the server restored\nmissed messages since the last disconnection:\n\n- **First subscription**: always "
3162
- },
3163
- {
3164
- "kind": "code",
3165
- "text": "`false`"
3166
- },
3167
- {
3168
- "kind": "text",
3169
- "text": ". The client has no prior\n message history, so the server can't restore anything. Load your\n initial state independently.\n\n- **Re-subscription after reconnect, "
3170
- },
3171
- {
3172
- "kind": "code",
3173
- "text": "`true`"
3174
- },
3175
- {
3176
- "kind": "text",
3177
- "text": "**: the server\n found the last received message and replayed everything since.\n No action needed.\n\n- **Re-subscription after reconnect, "
3178
- },
3179
- {
3180
- "kind": "code",
3181
- "text": "`false`"
3182
- },
3183
- {
3184
- "kind": "text",
3185
- "text": "**: the server\n couldn't restore missed messages (for example, they expired). Resync your\n state independently.\n\n<!-- TODO: Document server-side buffer limits for message replay. -->"
2903
+ "text": " parameter indicates whether missed messages were restored."
3186
2904
  }
3187
2905
  ],
3188
2906
  "blockTags": [
@@ -3192,7 +2910,7 @@
3192
2910
  "content": [
3193
2911
  {
3194
2912
  "kind": "text",
3195
- "text": "ID of the subscription that was established."
2913
+ "text": "ID of the subscription."
3196
2914
  }
3197
2915
  ]
3198
2916
  },
@@ -3202,7 +2920,55 @@
3202
2920
  "content": [
3203
2921
  {
3204
2922
  "kind": "text",
3205
- "text": "Whether the server successfully restored missed messages."
2923
+ "text": "Whether the server successfully restored missed messages since the last disconnection.\n\nThe value of this parameter depends on the scenario:\n\n- When subscribing for the first time, "
2924
+ },
2925
+ {
2926
+ "kind": "code",
2927
+ "text": "`isSynced`"
2928
+ },
2929
+ {
2930
+ "kind": "text",
2931
+ "text": " is "
2932
+ },
2933
+ {
2934
+ "kind": "code",
2935
+ "text": "`false`"
2936
+ },
2937
+ {
2938
+ "kind": "text",
2939
+ "text": ", as there are no prior messages to restore. In this scenario, load your initial state independently.\n\n- When re-subscribing and all messages were successfully restored, "
2940
+ },
2941
+ {
2942
+ "kind": "code",
2943
+ "text": "`isSynced`"
2944
+ },
2945
+ {
2946
+ "kind": "text",
2947
+ "text": " is "
2948
+ },
2949
+ {
2950
+ "kind": "code",
2951
+ "text": "`true`"
2952
+ },
2953
+ {
2954
+ "kind": "text",
2955
+ "text": ". No further action is necessary.\n\n- When re-subscribing but some messages weren't restored, "
2956
+ },
2957
+ {
2958
+ "kind": "code",
2959
+ "text": "`isSynced`"
2960
+ },
2961
+ {
2962
+ "kind": "text",
2963
+ "text": " is "
2964
+ },
2965
+ {
2966
+ "kind": "code",
2967
+ "text": "`false`"
2968
+ },
2969
+ {
2970
+ "kind": "text",
2971
+ "text": ". The server is unable to restore all missed messages. In this scenario, you need to resync your state independently.\n\n<!-- TODO: Document server-side buffer limits for message replay. -->"
3206
2972
  }
3207
2973
  ]
3208
2974
  }
@@ -3227,23 +2993,15 @@
3227
2993
  "summary": [
3228
2994
  {
3229
2995
  "kind": "text",
3230
- "text": "Called when a subscription error occurs.\n\nThis handler is triggered in the following scenarios:\n\n- **Subscription failed**: the subscription request was rejected (for example,\n due to an authorization failure). The error includes the HTTP\n "
2996
+ "text": "Runs when a subscription error occurs. It can run multiple times in a single session.\n\nThis handler runs in the following scenarios:\n\n- **Subscription failed**: The subscription request was rejected, for example, due to an authorization failure. This error is non-recoverable, so the subscription isn't automatically re-attempted.\n\n- **Subscription disconnected**: The connection between the subscriber and publisher was closed. Check "
3231
2997
  },
3232
2998
  {
3233
2999
  "kind": "code",
3234
- "text": "`status`"
3235
- },
3236
- {
3237
- "kind": "text",
3238
- "text": " code. This is non-recoverable and the subscription\n doesn't retry automatically.\n\n- **Disconnected**: the connection was closed. Check the "
3239
- },
3240
- {
3241
- "kind": "code",
3242
- "text": "`recoverable`"
3000
+ "text": "`error.recoverable`"
3243
3001
  },
3244
3002
  {
3245
3003
  "kind": "text",
3246
- "text": "\n flag to determine whether the client is auto-reconnecting ("
3004
+ "text": ":\n - When "
3247
3005
  },
3248
3006
  {
3249
3007
  "kind": "code",
@@ -3251,7 +3009,7 @@
3251
3009
  },
3252
3010
  {
3253
3011
  "kind": "text",
3254
- "text": ") or\n whether you need to re-create the subscription ("
3012
+ "text": ", the error is recoverable. The subscription is automatically re-attempted. No further action necessary.\n - When "
3255
3013
  },
3256
3014
  {
3257
3015
  "kind": "code",
@@ -3259,11 +3017,11 @@
3259
3017
  },
3260
3018
  {
3261
3019
  "kind": "text",
3262
- "text": ").\n\n- **Connection error**: fired on each failed reconnection attempt.\n The "
3020
+ "text": ", the error isn't recoverable. Establish the subscription again.\n\n- **Connection error**: Runs on each failed subscription attempt. The "
3263
3021
  },
3264
3022
  {
3265
3023
  "kind": "code",
3266
- "text": "`recoverable`"
3024
+ "text": "`error.recoverable`"
3267
3025
  },
3268
3026
  {
3269
3027
  "kind": "text",
@@ -3275,23 +3033,7 @@
3275
3033
  },
3276
3034
  {
3277
3035
  "kind": "text",
3278
- "text": " for these errors because the\n client keeps retrying with exponential backoff.\n\nCheck "
3279
- },
3280
- {
3281
- "kind": "code",
3282
- "text": "`error.recoverable`"
3283
- },
3284
- {
3285
- "kind": "text",
3286
- "text": " to distinguish transient errors from permanent\nfailures. This handler may fire multiple times during a single session.\nA typical recovery flow looks like:\n"
3287
- },
3288
- {
3289
- "kind": "code",
3290
- "text": "`subscribed → error (recoverable) → error (recoverable) → subscribed`"
3291
- },
3292
- {
3293
- "kind": "text",
3294
- "text": "."
3036
+ "text": ", as the subscription is re-established."
3295
3037
  }
3296
3038
  ],
3297
3039
  "blockTags": [
@@ -3301,7 +3043,23 @@
3301
3043
  "content": [
3302
3044
  {
3303
3045
  "kind": "text",
3304
- "text": "The error that occurred."
3046
+ "text": "Error that occurred. Check "
3047
+ },
3048
+ {
3049
+ "kind": "code",
3050
+ "text": "`errorCode`"
3051
+ },
3052
+ {
3053
+ "kind": "text",
3054
+ "text": " and "
3055
+ },
3056
+ {
3057
+ "kind": "code",
3058
+ "text": "`recoverable`"
3059
+ },
3060
+ {
3061
+ "kind": "text",
3062
+ "text": " to determine the type and whether manual action is required."
3305
3063
  }
3306
3064
  ]
3307
3065
  },
@@ -3311,7 +3069,7 @@
3311
3069
  "content": [
3312
3070
  {
3313
3071
  "kind": "text",
3314
- "text": "ID of the affected subscription."
3072
+ "text": "ID of the subscription that generated the error."
3315
3073
  }
3316
3074
  ]
3317
3075
  }
@@ -3345,7 +3103,7 @@
3345
3103
  "summary": [
3346
3104
  {
3347
3105
  "kind": "text",
3348
- "text": "Options for specifying what to unsubscribe from.\n\nSpecify "
3106
+ "text": "Unsubscribe options. Specify "
3349
3107
  },
3350
3108
  {
3351
3109
  "kind": "code",
@@ -3353,7 +3111,7 @@
3353
3111
  },
3354
3112
  {
3355
3113
  "kind": "text",
3356
- "text": " to remove all subscriptions to a channel, "
3114
+ "text": ", "
3357
3115
  },
3358
3116
  {
3359
3117
  "kind": "code",
@@ -3361,15 +3119,15 @@
3361
3119
  },
3362
3120
  {
3363
3121
  "kind": "text",
3364
- "text": " to remove\na single subscription, or both to remove a specific subscription with channel verification.\nAt least one of "
3122
+ "text": ", or both:\n\n- To remove all subscriptions from a channel, specify the channel in "
3365
3123
  },
3366
3124
  {
3367
3125
  "kind": "code",
3368
- "text": "`channel`"
3126
+ "text": "`channel.name`"
3369
3127
  },
3370
3128
  {
3371
3129
  "kind": "text",
3372
- "text": " or "
3130
+ "text": ".\n- To remove a single subscription, specify the "
3373
3131
  },
3374
3132
  {
3375
3133
  "kind": "code",
@@ -3377,7 +3135,7 @@
3377
3135
  },
3378
3136
  {
3379
3137
  "kind": "text",
3380
- "text": " is required."
3138
+ "text": ".\n- To remove a single subscription with channel verification, specify both. This removes the specified subscription only if it listens to the specified channel."
3381
3139
  }
3382
3140
  ]
3383
3141
  },
@@ -3394,15 +3152,7 @@
3394
3152
  "summary": [
3395
3153
  {
3396
3154
  "kind": "text",
3397
- "text": "Channel to unsubscribe from. When specified without "
3398
- },
3399
- {
3400
- "kind": "code",
3401
- "text": "`subscriptionId`"
3402
- },
3403
- {
3404
- "kind": "text",
3405
- "text": ",\nall subscriptions to this channel are removed."
3155
+ "text": "Channel or resource to unsubscribe from.\n\nWhen empty, the subscription is removed without verifying that it belongs to the channel."
3406
3156
  }
3407
3157
  ]
3408
3158
  },
@@ -3425,15 +3175,7 @@
3425
3175
  "summary": [
3426
3176
  {
3427
3177
  "kind": "text",
3428
- "text": "ID of the subscription to remove. When specified without "
3429
- },
3430
- {
3431
- "kind": "code",
3432
- "text": "`channel`"
3433
- },
3434
- {
3435
- "kind": "text",
3436
- "text": ",\nthe specific subscription is removed regardless of its channel."
3178
+ "text": "ID of the subscription to remove.\n\nWhen empty, all subscriptions to the specified channel are removed."
3437
3179
  }
3438
3180
  ]
3439
3181
  },
@@ -3478,7 +3220,7 @@
3478
3220
  "summary": [
3479
3221
  {
3480
3222
  "kind": "text",
3481
- "text": "Callback that runs when a message is received on a subscribed channel or channel resource."
3223
+ "text": "Runs when a message is published to a channel or resource the subscriber listens to."
3482
3224
  }
3483
3225
  ]
3484
3226
  },
@@ -3493,7 +3235,7 @@
3493
3235
  "summary": [
3494
3236
  {
3495
3237
  "kind": "text",
3496
- "text": "The received message, including the payload and optional publisher information."
3238
+ "text": "Published message."
3497
3239
  }
3498
3240
  ]
3499
3241
  },
@@ -3514,7 +3256,7 @@
3514
3256
  "summary": [
3515
3257
  {
3516
3258
  "kind": "text",
3517
- "text": "The channel the message was received on."
3259
+ "text": "Channel the message was published to."
3518
3260
  }
3519
3261
  ]
3520
3262
  },
@@ -3560,7 +3302,7 @@
3560
3302
  "summary": [
3561
3303
  {
3562
3304
  "kind": "text",
3563
- "text": "Callback that runs when a subscription error occurs."
3305
+ "text": "Runs when a subscription error occurs."
3564
3306
  }
3565
3307
  ]
3566
3308
  },
@@ -3575,7 +3317,7 @@
3575
3317
  "summary": [
3576
3318
  {
3577
3319
  "kind": "text",
3578
- "text": "The error that occurred."
3320
+ "text": "Error that occurred."
3579
3321
  }
3580
3322
  ]
3581
3323
  },
@@ -3596,7 +3338,7 @@
3596
3338
  "summary": [
3597
3339
  {
3598
3340
  "kind": "text",
3599
- "text": "ID of the affected subscription."
3341
+ "text": "ID of the subscription that generated the error."
3600
3342
  }
3601
3343
  ]
3602
3344
  },
@@ -3640,7 +3382,15 @@
3640
3382
  "summary": [
3641
3383
  {
3642
3384
  "kind": "text",
3643
- "text": "Callback that runs when a subscription is successfully established or re-established after a reconnection."
3385
+ "text": "Runs when a subscription is successfully established or re-established.\n\nWhen a subscription fails and is re-established, the subscriber might not receive all messages published during the failure. The "
3386
+ },
3387
+ {
3388
+ "kind": "code",
3389
+ "text": "`isSynced`"
3390
+ },
3391
+ {
3392
+ "kind": "text",
3393
+ "text": " flag indicates whether all missed messages were successfully delivered.\n\n<!-- TODO: Document server-side buffer limits for message replay. -->"
3644
3394
  }
3645
3395
  ]
3646
3396
  },
@@ -3655,7 +3405,7 @@
3655
3405
  "summary": [
3656
3406
  {
3657
3407
  "kind": "text",
3658
- "text": "ID of the subscription."
3408
+ "text": "Subscription ID."
3659
3409
  }
3660
3410
  ]
3661
3411
  },
@@ -3674,7 +3424,7 @@
3674
3424
  "summary": [
3675
3425
  {
3676
3426
  "kind": "text",
3677
- "text": "Whether the server successfully restored missed messages since the last disconnection. <!-- TODO: Document server-side buffer limits for message replay. -->"
3427
+ "text": "Whether the message history was fully restored."
3678
3428
  }
3679
3429
  ]
3680
3430
  },
@@ -3743,11 +3493,32 @@
3743
3493
  "symbolIdMap": {}
3744
3494
  },
3745
3495
  "appendices": {
3496
+ "/": [
3497
+ {
3498
+ "type": "GUIDE",
3499
+ "title": "Introduction",
3500
+ "src": "---\narticleType: intro\n---\n\n# About the Realtime APIs\n\nThe Realtime APIs let you send and receive messages between a site backend and connected clients in real time. When a backend service publishes messages to a channel, clients subscribed to that channel receive them instantly.\n\nWith the Realtime APIs, you can:\n\n- Publish messages from the backend to channels and channel resources.\n- Subscribe to channels and resources to receive messages on connected clients.\n- Control which subscribers receive messages on specific channels or channel resources.\n\nThe Realtime APIs consist of the following modules that work together:\n\n- [**Publisher**](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/publisher/introduction): Backend module that sends messages to channels.\n- [**Site**](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/introduction): Backend module that manages subscriber permissions.\n- [**Subscriber**](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction): Client module that listens to channels and receives messages.\n\n## How the modules work together\n\nThe Publisher sends a message to a channel or channel resource. The Site module checks whether each subscriber has permission to listen on that channel. Subscribers that have the appropriate permissions receive the message in real time.\n\nA typical flow looks like this:\n\n1. Define permissions in the **realtime-permissions.js** in the site's backend using the [Site API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/introduction).\n2. A client subscribes to a channel or channel resource using the [Subscriber API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction).\n3. The [`realtime_check_permission`](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/realtime-check-permission) hook checks the subscriber's permissions.\n4. The [Publisher](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/publisher/introduction) publishes a message to the channel.\n5. The subscriber receives the message.\n\n## Channels and channel resources\n\nChannels are the mechanism by which publishers send messages to subscribers. Each channel has a unique name and can contain resources that act as sub-channels. Clients can subscribe to a channel or resource. When a publisher sends a message, subscribers receive the messages instantly if they have the appropriate permissions.\n\nChannels and resources are strictly isolated: subscribing to a channel doesn't include messages published to a resource on that channel, and subscribing to a resource doesn't include messages published to the parent channel.\n\n## Publisher\n\nThe [Publisher API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/publisher/introduction) is a backend module that sends messages to subscribers listening to the specified channel or resource.\n\n## Site\n\nThe [Site API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/introduction) controls subscriber permissions. It determines which subscribers can receive messages on specific channels and resources.\n\nLearn more about [permissions in the Site API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction).\n\n## Subscribers\n\nA subscriber is a client that listens to a channel or resource. When a message is published to a channel or resource, all subscribers with [the appropriate permissions](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction) receive the message. \n\nYou can set up dedicated handlers for incoming messages, subscription successes, and subscription failures.\n\nLearn more about the [Subscriber API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction).\n\n\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- Messages are ephemeral. They don't persist across sessions.\n- When previewing the site, `read` permissions are always `true`.\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## Terminology\n\n- **Channel**: Named broadcast channel that publishers send messages to and subscribers listen on.\n- **Resource**: Isolated sub-channel in a channel. Messages on a resource are isolated from messages on its parent channel.\n- **Message**: Data published to a channel or resource.\n- **Publisher**: Service that sends messages to subscribers.\n- **Subscriber**: Client that listens for messages on a channel or resource.\n- **Subscription**: Active connection between a subscriber and a channel or resource, identified by a subscription ID.\n\n"
3501
+ }
3502
+ ],
3503
+ "/publisher": [
3504
+ {
3505
+ "type": "GUIDE",
3506
+ "title": "Introduction",
3507
+ "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](ADDLINK). [Subscribers](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction) with suitable [permissions](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction) receive these messages instantly. Channels and resources are isolated, so messages sent to a channel are not published to a resource, and vice versa.\n\nLearn more [about the Realtime APIs](ADDLINK).\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 aren't queued. When no subscribers are listening, the message is dropped.\n- Messages don't persist across sessions.\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@sdk_package_setup\n"
3508
+ }
3509
+ ],
3510
+ "/subscriber": [
3511
+ {
3512
+ "type": "GUIDE",
3513
+ "title": "Introduction",
3514
+ "src": "---\narticleType: intro\n---\n\n# About the Subscriber API\n\nThe Subscriber API allows users to subscribe to [channels and resources](ADDLINK). When a [publisher](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/publisher/introduction) sends messages, subscribers with suitable permissions receive them in real time. Channels and resources are isolated, so messages sent to a channel aren't published to a resource, and vice versa.\n\nLearn more [about the Realtime APIs](ADDLINK).\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\nWhile subscribing is asynchronous, the `subscribe()` method returns a subscription ID immediately, but the connection is established in the background. Subscribers can use the subscription ID to [unsubscribe](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/unsubscribe) at a later time. \n\nYou can register lifecycle handlers to respond when the subscription succeeds or fails. The [`onSubscribed` handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) runs on every successful connection, including automatic re-subscriptions attempted after network interruptions. The [`onSubscriptionError` handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) runs whenever an error occurs.\n\n### Unsubscribing\n\nYou can unsubscribe in the following ways:\n\n- By `subscriptionId`: Removes a single subscription.\n- By `channel`: Removes all subscriptions to that channel or resource.\n- By both: Removes the specific subscription, verifying it matches the specified channel or resource. If it doesn't, the subscription isn't removed.\n\nWhen the last subscription on a connection is removed, the connection closes automatically.\n\n## Reconnection and message sync\n\nIf the connection drops, the client automatically attempts to reconnect and re-subscribe. When subscribing or re-subscribing, the `isSynced` parameter of the `onSubscribed()` hook indicates whether all missed messages were successfully restored, or whether manual 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 server-side buffer limits for message replay. -->\n\n## Subscription errors\n\nSubscription errors are caused by the subscription being rejected or by connection failures. Each error includes `errorCode` and `recoverable` properties that indicate the error type and whether the client is automatically retrying.\n\nLearn more about how the [`subscribe()`](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) method handles subscription errors.\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- Subscriptions are ephemeral. They don't persist across sessions.\n- Closing a browser tab removes all its subscriptions.\n- Permissions are checked when a subscription is first established. When a subscriber doesn't have `read` permission on the channel, their subscription fails.\n<!-- TODO: Document channel/subscription limits per site/app. -->\n\n<!-- ## Use cases\n\n- [Send notifications to connected clients](ADDLINK).\n- [Broadcast data updates in real time](ADDLINK).\n- [Push state changes to a live dashboard](ADDLINK). -->\n\n## Terminology\n\n- **Subscription**: An active connection between a client and a channel or resource, identified by a subscription ID.\n- **Subscription ID**: A unique identifier returned by `subscribe()`. Use it to unsubscribe or track lifecycle events.\n\n@sdk_package_setup\n"
3515
+ }
3516
+ ],
3746
3517
  "/site": [
3747
3518
  {
3748
3519
  "type": "GUIDE",
3749
3520
  "title": "Introduction",
3750
- "src": "# Introduction\n\n> **Note:** This API is only intended for use in [site development](https://dev.wix.com/docs/sdk/articles/get-started/about-site-development).\n\nUsing the Realtime API you can create channels and channel resources where messages\ncan be published. Site visitors who subscribe to a channel receive the\nmessages published to that channel. When a message is received you can handle the message any\nway you choose, such as displaying the contents of the message or changing the state\nof page elements depending on the contents of the message. You can also manage the\npermissions of who can read from specific channels.\n\nThe `@wix/realtime` module is used in conjunction with the [`@wix/site-realtime`](https://dev.wix.com/docs/sdk/frontend-modules/site-realtime/introduction) module.\n\nGet hands-on experience with the Realtime API on our [Hello Realtime](https://www.wix.com/velo/example/hello-realtime) example page.\n\nTypical uses of the Realtime API include implementing a messaging system or\nas an alternative to using a polling mechanism.\n\nThe Realtime API uses the following terminology:\n\n+ **Channel**: A specific channel on which messages are published. Each channel\n has a unique name. Site visitors can subscribe to a channel to receive the \n messages that are published on it. When site visitors subscribe to a channel, they do not \n receive messages published to a resource on that same channel.\n+ **Channel resource**: A subchannel on which messages are published. Subchannels\n can share a name with a channel and other subchannels, but they have a unique\n resource ID. When site visitors subscribe to a channel resource, they do not \n receive messages published to that same channel without a specified resource.\n Channel resources inherit their parent channel's permissions, unless specified\n otherwise.\n+ **Message**: A message published on a channel or channel resource. A message can\n be of any type, such as a string, number, or object. Channel subscribers receive\n the messages published on the channel.\n+ **Publish**: Sending a message over a channel or channel resource.\n+ **Subscribe**: A site visitor subscribes to receive the messages published on a \n channel or channel resource.\n+ **Permissions router**: The permissions router is used to define the permissions\n you want to grant to subscribers on channels and channel resources.\n+ **Permissions handler**: Handles a permissions check for a specific user on a \n specific channel or channel resource.\n\nFor a tutorial on using the Realtime API, see \n[Sending Messages with the Realtime API](https://dev.wix.com/docs/develop-websites/articles/code-tutorials/wix-editor-elements/sending-messages-with-the-realtime-api).\n"
3521
+ "src": "---\narticleType: intro\n---\n\n# About the Site API\n\nThe Site API lets you control subscriber permissions for the [Realtime APIs](ADDLINK). It determines which [subscribers](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction) can receive messages on specific [channels and resources](ADDLINK).\n\nTo define permissions, set up the [`realtime_check_permission` hook](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/realtime-check-permission) in the **realtime-permissions.js** file in a site's backend. You can include all permissions logic directly in the hook, or use the [permissions router](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction) to organize permissions logic per channel and resource.\n\nWith the Site API, you can:\n\n- Define the `realtime_check_permission` hook to control subscriber access.\n- Use the [permissions router](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction) to organize permission logic per channel or resource.\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- In Wix Studio, you must create a **realtime-permissions.js** file in a site's backend, even if the `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- Learn more about [permissions in the realtime SDK](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction).\n\n<!-- ## Use cases\n\n- [Restrict channels to logged-in members](ADDLINK). -->\n\n@sdk_package_setup"
3751
3522
  },
3752
3523
  {
3753
3524
  "type": "GUIDE",
@@ -3810,7 +3581,7 @@
3810
3581
  {
3811
3582
  "type": "GUIDE",
3812
3583
  "title": "Introduction",
3813
- "src": "# Introduction\n\nUse the permissions router to define the permissions you want to grant to subscribers\non channels or channel resources. You can set permissions on the channel and channel\nresource level. If you do not define permissions for a particular channel resource,\nthat resource inherits the permissions of its parent channel.\n\nTypically you use the permissions router in the **realtime-permissions.js** file in\nyour site's backend to:\n\n+ Set default permissions for all channels and channel resources where no explicit\n permissions are defined.\n+ Add permissions logic for specific channels or channel resources.\n+ Check the permissions for a specific subscriber on a specific channel.\n\n> **Note:** Although it is recommended, you do not need to use the permissions router to set permissions. You can also define all your permissions logic in the [`realtime_check_permission()`](https://dev.wix.com/docs/sdk/backend-modules/realtime/site/realtime-check-permission) function."
3584
+ "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 in the [`realtime_check_permission()` hook](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/introduction).\n\nLearn more about the [Site API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/introduction) and the [Realtime APIs](ADDLINK).\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:\n\n1. Create a **realtime-permissions.js** file in a site's backend.\n2. Export a `realtime_check_permission` hook. This hook runs automatically whenever a subscription is attempted.\n3. In the hook body, call `permissionsRouter.check()` to evaluate the subscriber's permissions based on the handlers you've registered.\n\n```js\nimport { permissionsRouter } from '@wix/realtime';\n\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## 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 the specified 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 specified or 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## 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. 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\n- [Restrict channels to logged-in members](ADDLINK). -->\n\n@sdk_package_setup"
3814
3585
  }
3815
3586
  ],
3816
3587
  "/site/PermissionsRouter/add": [