@wix/realtime 1.0.39 → 1.0.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/statics/docs-ts-model.json +18 -42
- package/package.json +3 -3
|
@@ -450,15 +450,6 @@
|
|
|
450
450
|
}
|
|
451
451
|
]
|
|
452
452
|
},
|
|
453
|
-
{
|
|
454
|
-
"tag": "@servicePath",
|
|
455
|
-
"content": [
|
|
456
|
-
{
|
|
457
|
-
"kind": "text",
|
|
458
|
-
"text": "wix-realtime-backend.ChannelPermissions"
|
|
459
|
-
}
|
|
460
|
-
]
|
|
461
|
-
},
|
|
462
453
|
{
|
|
463
454
|
"tag": "@servicePath",
|
|
464
455
|
"content": [
|
|
@@ -701,15 +692,6 @@
|
|
|
701
692
|
}
|
|
702
693
|
]
|
|
703
694
|
},
|
|
704
|
-
{
|
|
705
|
-
"tag": "@servicePath",
|
|
706
|
-
"content": [
|
|
707
|
-
{
|
|
708
|
-
"kind": "text",
|
|
709
|
-
"text": "wix-realtime-backend.ChannelPermissions"
|
|
710
|
-
}
|
|
711
|
-
]
|
|
712
|
-
},
|
|
713
695
|
{
|
|
714
696
|
"tag": "@servicePath",
|
|
715
697
|
"content": [
|
|
@@ -732,7 +714,7 @@
|
|
|
732
714
|
"summary": [
|
|
733
715
|
{
|
|
734
716
|
"kind": "text",
|
|
735
|
-
"text": "Channel or resource
|
|
717
|
+
"text": "Channel or resource to check."
|
|
736
718
|
}
|
|
737
719
|
]
|
|
738
720
|
},
|
|
@@ -753,7 +735,7 @@
|
|
|
753
735
|
"summary": [
|
|
754
736
|
{
|
|
755
737
|
"kind": "text",
|
|
756
|
-
"text": "Subscriber
|
|
738
|
+
"text": "Subscriber to check permissions for."
|
|
757
739
|
}
|
|
758
740
|
]
|
|
759
741
|
},
|
|
@@ -815,7 +797,7 @@
|
|
|
815
797
|
"summary": [
|
|
816
798
|
{
|
|
817
799
|
"kind": "text",
|
|
818
|
-
"text": "Sets a permissions handler for a specific channel or resource.\n\nAdding a handler to a channel without specifying a resource
|
|
800
|
+
"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)."
|
|
819
801
|
}
|
|
820
802
|
],
|
|
821
803
|
"blockTags": [
|
|
@@ -936,7 +918,7 @@
|
|
|
936
918
|
"summary": [
|
|
937
919
|
{
|
|
938
920
|
"kind": "text",
|
|
939
|
-
"text": "Checks permissions for a subscriber on a channel or resource.\n\nRuns the permissions handler
|
|
921
|
+
"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)."
|
|
940
922
|
}
|
|
941
923
|
],
|
|
942
924
|
"blockTags": [
|
|
@@ -985,15 +967,6 @@
|
|
|
985
967
|
}
|
|
986
968
|
]
|
|
987
969
|
},
|
|
988
|
-
{
|
|
989
|
-
"tag": "@servicePath",
|
|
990
|
-
"content": [
|
|
991
|
-
{
|
|
992
|
-
"kind": "text",
|
|
993
|
-
"text": "wix-realtime-backend.ChannelPermissions"
|
|
994
|
-
}
|
|
995
|
-
]
|
|
996
|
-
},
|
|
997
970
|
{
|
|
998
971
|
"tag": "@servicePath",
|
|
999
972
|
"content": [
|
|
@@ -1086,7 +1059,7 @@
|
|
|
1086
1059
|
"summary": [
|
|
1087
1060
|
{
|
|
1088
1061
|
"kind": "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
|
|
1062
|
+
"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)."
|
|
1090
1063
|
}
|
|
1091
1064
|
],
|
|
1092
1065
|
"blockTags": [
|
|
@@ -3493,32 +3466,35 @@
|
|
|
3493
3466
|
"symbolIdMap": {}
|
|
3494
3467
|
},
|
|
3495
3468
|
"appendices": {
|
|
3496
|
-
"/": [
|
|
3469
|
+
"/publisher": [
|
|
3497
3470
|
{
|
|
3498
3471
|
"type": "GUIDE",
|
|
3499
3472
|
"title": "Introduction",
|
|
3500
|
-
"src": "---\narticleType: intro\n---\n\n# About the
|
|
3501
|
-
}
|
|
3502
|
-
],
|
|
3503
|
-
"/publisher": [
|
|
3473
|
+
"src": "---\narticleType: intro\n---\n\n# About the Publisher API\n\nThe Publisher API is a backend module for sending messages to [channels and resources](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction#channels-and-channel-resources). [Subscribers](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 aren't delivered to a resource, and vice versa.\n\nLearn more [about the Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction).\n\n<!-- TODO check that elevation note appears in method description -->\n<!-- TODO: Check whether this API is relevant for headless projects. -->\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- Messages 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"
|
|
3474
|
+
},
|
|
3504
3475
|
{
|
|
3505
3476
|
"type": "GUIDE",
|
|
3506
|
-
"title": "
|
|
3507
|
-
"src": "
|
|
3477
|
+
"title": "Setup",
|
|
3478
|
+
"src": "# Setup\n\n@package_metadata:@wix/realtime\n\nTo use the Realtime API, install the `@wix/realtime` package.\n\n#### Install the package\n\nFollow the installation instructions for your development environment.\n\n| Development environment | Installation method |\n| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Wix sites (editor or IDE) | Use the [package manager](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-in-the-editor). |\n| Wix sites (local IDE) | Run `wix install @wix/realtime` using the [CLI](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-with-the-wix-cli). |\n\n#### Import the package\n\nTo import the package in your code:\n\n```js\nimport { publisher } from '@wix/realtime';\n```\n"
|
|
3508
3479
|
}
|
|
3509
3480
|
],
|
|
3510
3481
|
"/subscriber": [
|
|
3511
3482
|
{
|
|
3512
3483
|
"type": "GUIDE",
|
|
3513
3484
|
"title": "Introduction",
|
|
3514
|
-
"src": "---\narticleType: intro\n---\n\n# About the Subscriber API\n\nThe Subscriber API
|
|
3485
|
+
"src": "---\narticleType: intro\n---\n\n# About the Subscriber API\n\nThe Subscriber API lets clients subscribe to [channels and resources](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction#channels-and-channel-resources). When a [publisher](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\nThe `subscribe()` method returns a subscription ID immediately, but the connection is established in the background. Subscribers can use the subscription ID to [unsubscribe](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/unsubscribe) at a later time.\n\nYou can register lifecycle handlers to respond when the subscription succeeds or fails. The [`onSubscribed` handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) runs on every successful connection, including automatic re-subscriptions attempted after network interruptions. The [`onSubscriptionError` handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) runs whenever an error occurs.\n\n### Unsubscribing\n\nYou can unsubscribe in the following ways:\n\n- By `subscriptionId`: Removes a single subscription.\n- 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()` handler indicates whether all missed messages were successfully restored, or whether the subscriber needs to take further action.\n\nLearn more about [subscribing](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) to a channel or resource.\n\n<!-- TODO: Document backend buffer limits for message replay. -->\n\n## Subscription errors\n\nSubscription errors occur when a subscription is rejected or when the connection fails. Each error includes `errorCode` and `recoverable` properties that indicate the error type and whether the client is automatically retrying.\n\nLearn more about how the [`subscribe()`](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/subscribe) method handles subscription errors.\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- Subscriptions are ephemeral. They don't persist across sessions.\n- Closing a browser tab removes all its subscriptions.\n- The Realtime SDK checks permissions when a subscription is first established. When a subscriber doesn't have `read` permission on the channel, the subscription fails.\n<!-- TODO: Document channel/subscription limits per site/app. -->\n\n<!-- ## Use cases\n\n- [Send notifications to connected clients](ADDLINK).\n- [Broadcast data updates in real time](ADDLINK).\n- [Push state changes to a live dashboard](ADDLINK). -->\n\n## 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"
|
|
3486
|
+
},
|
|
3487
|
+
{
|
|
3488
|
+
"type": "GUIDE",
|
|
3489
|
+
"title": "Setup",
|
|
3490
|
+
"src": "# Setup\n\n@package_metadata:@wix/realtime\n\nTo use the Realtime API, install the `@wix/realtime` package.\n\n#### Install the package\n\nFollow the installation instructions for your development environment.\n\n| Development environment | Installation method |\n| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Wix sites (editor or IDE) | Use the [package manager](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-in-the-editor). |\n| Wix sites (local IDE) | Run `wix install @wix/realtime` using the [CLI](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-with-the-wix-cli). |\n\n#### Import the package\n\nTo import the package in your code:\n\n```js\nimport { subscriber } from '@wix/realtime';\n```\n"
|
|
3515
3491
|
}
|
|
3516
3492
|
],
|
|
3517
3493
|
"/site": [
|
|
3518
3494
|
{
|
|
3519
3495
|
"type": "GUIDE",
|
|
3520
3496
|
"title": "Introduction",
|
|
3521
|
-
"src": "---\narticleType: intro\n---\n\n# About the Site API\n\nThe Site API lets you control subscriber permissions for the [Realtime APIs](
|
|
3497
|
+
"src": "---\narticleType: intro\n---\n\n# About the Site API\n\nThe Site API lets you control subscriber permissions for the [Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction). It determines which [subscribers](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/subscriber/introduction) can receive messages on specific [channels and resources](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction#channels-and-channel-resources).\n\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 `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\nLearn 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\n"
|
|
3522
3498
|
},
|
|
3523
3499
|
{
|
|
3524
3500
|
"type": "GUIDE",
|
|
@@ -3581,7 +3557,7 @@
|
|
|
3581
3557
|
{
|
|
3582
3558
|
"type": "GUIDE",
|
|
3583
3559
|
"title": "Introduction",
|
|
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/
|
|
3560
|
+
"src": "---\narticleType: intro\n---\n\n# About the Permissions Router API\n\nThe Permissions Router API is a utility for organizing channel permission logic. The router lets you set up a default permissions handler as well as handlers specific to channels or resources.\n\n> **Note**: Alternatively, you can include permissions logic directly in the [`realtime_check_permission()` hook](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/realtime-check-permission).\n\nLearn more about the [Site API](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/introduction) and the [Realtime APIs](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/introduction).\n\nWith the Permissions Router API, you can:\n\n- [Add a handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/add) for a specific channel or resource.\n- [Set a default handler](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/default) for channels that don't have explicit handlers.\n- [Check](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/permissions-router/check) subscriber permissions.\n\n## Setting up permissions\n\nTo set up permissions:\n\n1. Create a **realtime-permissions.js** file in a site's backend.\n2. Import the `permissionsRouter` in your code:\n\n ```js\n import { permissionsRouter } from \"@wix/realtime\";\n ```\n\n3. Export a `realtime_check_permission` hook. This hook runs automatically whenever a subscription is attempted.\n4. In the hook body, call `permissionsRouter.check()` to evaluate the subscriber's permissions based on the handlers you've registered.\n\n ```js\n permissionsRouter.default((channel, subscriber) => {\n return { read: true };\n });\n\n export function realtime_check_permission(channel, subscriber) {\n return permissionsRouter.check(channel, subscriber);\n }\n ```\n\n## Permission resolution\n\nPermissions can be set at the channel level or the resource level. They determine whether subscribers can receive messages published to that channel or resource.\n\nPermissions follow a cascading pattern:\n\n- When 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\n"
|
|
3585
3561
|
}
|
|
3586
3562
|
],
|
|
3587
3563
|
"/site/PermissionsRouter/add": [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/realtime",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.41",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"registry": "https://registry.npmjs.org/",
|
|
6
6
|
"access": "public"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@wix/sdk": "^1.21.4",
|
|
49
49
|
"@wix/sdk-runtime": "^1.0.9",
|
|
50
50
|
"@wix/sdk-types": "^1.17.5",
|
|
51
|
-
"@wix/sdk_realtime_site": "1.0.
|
|
51
|
+
"@wix/sdk_realtime_site": "1.0.32",
|
|
52
52
|
"uuid": "^11.1.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"isRootPublicSdk": true
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
|
-
"falconPackageHash": "
|
|
75
|
+
"falconPackageHash": "0cb740b899101f216960582b4cf3b79b8eda373e7510a3e7f9d7a72b"
|
|
76
76
|
}
|