> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt ## Resource: Realtime Permissions Provider Service Plugin ## Article: Realtime Permissions Provider Service Plugin ## Article Link: https://dev.wix.com/docs/sdk/core-modules/realtime/extensions/realtime-permissions-provider/realtime-permissions-provider-service-plugin.md ## Article Content: # Realtime Permissions Provider: Sample Flows This article presents a possible use case and corresponding sample flow that you can support. It provides a useful starting point as you plan your implementation. ## Check permissions for a cross-app subscription When a subscriber from another app attempts to subscribe to a channel managed by your app, Wix calls your Realtime Permissions service plugin to determine whether the subscriber can receive messages on that channel. > **Note:** Your app must have a [Realtime Permissions Provider extension](https://dev.wix.com/docs/sdk/core-modules/realtime/extensions/realtime-permissions-provider/extension-config.md) with a deployment URI. A cross-app subscription includes the following steps: 1. A site visitor or member on another app's site calls [Subscribe](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/subscribe.md) with your app's `appId`, requesting to subscribe to one of your app's [channels or resources](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction.md#channels-and-channel-resources). 2. Wix calls [Check Subscriber Permissions](https://dev.wix.com/docs/sdk/core-modules/realtime/extensions/realtime-permissions-provider/check-subscriber-permissions.md) with details of the requested subscription, along with request metadata: ```json { "request": { "channel": { "name": "premium-updates", "resourceId": "resource-456" }, "subscriber": { "id": "2f8b9c1a-4e7d-4a3f-b6c8-9d0e1f2a3b4c", "type": "MEMBER" }, "requestingAppId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }, "metadata": { "requestId": "12340987989.234092734777747", "identity": { "identityType": "MEMBER", "memberId": "2f8b9c1a-4e7d-4a3f-b6c8-9d0e1f2a3b4c" }, "languages": ["en-US"] } } ``` 3. Your service plugin applies your permissions logic. For example, the following implementation allows members and admins to subscribe to the `premium-updates` channel but denies visitors: ```js import { realtimePermissionsProvider } from '@wix/realtime/service-plugins'; realtimePermissionsProvider.provideHandlers({ checkSubscriberPermissions: async (payload) => { const { request, metadata } = payload; const { channel, subscriber, requestingAppId } = request; // Use metadata for site-specific or locale-aware logic. Similarly, use requestingAppId to apply per-app authorization rules. // Only allow access to the "premium-updates" channel // for members and admins. if (channel.name === 'premium-updates') { return { read: subscriber.type !== 'VISITOR' }; } // Allow all other channels by default. return { read: true }; }, }); ``` Learn more about [service plugin extensions](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/service-plugins/about-service-plugin-extensions.md). Your implementation must return an object with a `read` boolean. Return `true` to allow the subscription, or `false` to deny it: ```json { "read": true } ``` 4. Wix applies the `read` value from your response. If `read` is `true`, the subscriber starts receiving messages on the channel. If `read` is `false`, Wix denies the subscription and the subscriber doesn't receive messages. > **Note:** If your handler throws an error, times out, or is unreachable, Wix denies the subscription with a 503 HTTP status code.