Checks permissions for a subscriber on a channel or channel resource.
The realtime_check_permission
hook is triggered when a site visitor subscribes
to a channel to check what permissions the subscriber will have.
The realtime_check_permission()
function is not a function that you call from
your code. You define the function in a file named realtime-permissions.js
in your site's Backend section.
Important:
{"read": true}
.Implement permissions logic for channels and subscribers by either:
PermissionsRouter
to add permissions
logic per channel. Then call check()
in the body of
this function and return the permissions object it returns.Note: When previewing your site, permissions for read are always granted.
The channel, and optionally the resource, to check permissions for.
The subscriber to check permissions for.
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.