- Chat Admin Privileges
Chat Admin Privileges
Click below to play with Ably's chat admin privileges implementation and to browse through the code that powers it. You can test the demo in realtime, on multiple browser windows/devices, or with a friend.
This is an easy way to give your app users different roles and capabilities. This can be a useful functionality when you’re managing live experiences with multiple participants. For example, in a chat room where one user needs admin or moderator privileges to delete spam or inappropriate content.
You have the ability to give users different roles in different parts of your application, and you can switch those roles at any time. In the chat example, you would give one user admin role in a specific chat room, while they stay a simple participant in all other chat rooms. The user can only delete other user’s comments in the room where he has admin privileges.
Other Possible Features?
Ably gives you the flexibility to create a wide range of app features using the same basic building blocks. For example, beyond the message deletion use case we showed above, you could use the same logic for:
Customizing which users have access to different message interaction types, such as who can reply to a post
Including trusted information about the identity of a user in messages they send
Ably has simple yet powerful APIs to help you effortlessly build and implement admin privileges in your realtime application.
Channel is the unit of distribution of messages. Messages can be anything and a channel can represent a chat room, direct messaging, a virtual event etc. Users or their devices can connect to a specific channel. The Avatar Stack is not related to messages in a channel, but the digital place where an Avatar Stack can be used is the channel itself.
Ably’s support for JWTs allows a token-based authentication scheme that defines channel capabilities, as well as ‘admin privileges’ — or any other trusted information about a client that can be used to describe a user’s roles. Clients receive information about other clients on each message.
You'll need to do the following to get started.
Implement chat functionality using Ably message interactions and JWTs
Include custom user claims in your JWTs to represent the roles your application needs
Add logic into the user interface to process message interactions according to role information
Ably provides simple APIs to help you build live cursors that track all cursor movements in realtime, useful for collaborative applications.
Ably provides simple APIs to help you build live charts, that support insight and analysis.
Ably provides simple APIs to help you build an Activity feed, which displays a list of user actions in realtime.