Checks the permissions for a subscriber on a channel or channel resource.
The check()
function returns a Promise that resolves to the permissions for the
specified user on the specified channel or channel resource.
The check is performed as follows:
If a permissions handler for the specified channel or channel resource exists, it's invoked and its result is returned.
If no handler is found for the specified channel resource, but a handler exists for the resource's channel, it's invoked and its result is returned.
If no handler is found for the specified channel, but a default permissions handler exists, it's invoked and its result is returned.
If the default handler has not been found, the default permissions are returned.
The default permissions are:
{"read": true}
This function is typically called in the body of the
realtime_check_permission()
function like so:
Channel to check permissions for.
Subscriber to check permissions for.