Sets a permissions handler for a specific channel or channel resource.
The handler set by the add()
function is used for permission checks by the permissions
router for the channel or channel resource specified in the channel
property.
Adding a handler to a specific channel without a specified resource adds a handler for all permissions checks on the channel and all permissions checks on any of the channel's resources that do not have their own permissions handlers.
For example, suppose you have the following channel, resources, and permissions:
add()
functionadd()
functionPermissions will be checked as follows:
Channel or channel resource to add a permissions handler for.
handler(channel: Channel, subscriber: Subscriber): Promise<ChannelPermissions> | ChannelPermissions
The name of the
function or the function expression to use when checking permissions for the specified channel.