realtime_check_permission( )


Checks permissions for a subscriber on a channel or resource.

Set up this hook as a named export in the realtime-permissions.js file in a site's backend. The hook runs automatically whenever a new subscription is attempted, including re-subscriptions after reconnection. Permissions are checked once per subscription attempt. Changes to permissions don't affect active subscriptions until the subscriber reconnects.

Call check() in the body of this hook to use the Permissions Router to organize permissions logic. Alternatively, you can also include permissions logic directly in the hook body.

Learn more about setting up permissions.

Method Declaration
Copy
Method Parameters
channelChannelRequired

Channel and resource to check permissions for.


subscriberSubscriberRequired

Subscriber to check permissions for.

Returns
Return Type:Promise<ChannelPermissions>
Errors

This method doesn't return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?