Rate limiting a channel controls the speed of messages that is published to all concurrent clients in the channel
This method is useful when there is a large amount of messages going through the channel, which can make the message stream hard to follow. Setting a rate limit enables the SDK to queue up messages once the amount of message in a specified window
exceeds the defined limit
, allowing a slower stream of messages to be published to the user at the expense of adding more latency (because newer messages will be sent to the queue first and not delivered until all previous queued messages are delivered).
There is an internal limit of 1000 messages that can be queued by the rate limit service, if more than 1000 messages are queued up, the system may skip publishing the older messages in order to make room for newer messages. We believe this is the preferred behavior for users, as users will most likely want to see newer messages in a real-time conversation instead of waiting for a significant amount of time for old messages to be published to them first.
Note that the SDK permanently stores all messages it receives in the system before the rate limit comes into effect: in the case of a large spike of incoming messages, even if a message did not get published to a user in real-time, that user can still scroll up to see message history and see that past message.
The above method enables a rate limit of 5 messages every 60 seconds. Once a user sends more than 5 messages in 60 seconds, messages will be queued on the server and not published to other channel members until 60 seconds have passed.
In order to disable the rate limit, simply call EkoChannelModeration.removeRateLimit()
:
Note: This feature does not work with Broadcast
and Conversation
channel. Calling reateLimit()
or removeRateLimit()
on these channels will result in an error.
When a user is banned in a channel, they are removed from a channel and no longer able to participate or observe messages in that channel.
Moderators can ban and unban users. When a user is banned in a channel, they are forcebly removed from channel and may no longer participate or observe messages in that channel. All their previous messages in the channel will also be automatically deleted.
A user that has been banned from a channel can not rejoin the channel until they have been unbanned.
As well as the banning and unbanning of users, admins also have the ability to global ban a user. When a user is globally banned, they can no longer access Amity's network and will be forcebly removed from all their existing channels. All the globally banned user's messages will also be deleted.
The globally banned user can not access Amity's network again until they have been globally unbanned.
Banning users is a more heavy handed moderation method. When a user is banned, all its messages are retroactively deleted, it will be removed from the channel, and it will not be allowed to join the channel again until he is explicitly unbanned.
There is a separate unban call to unban a user:
Note: This feature does not work with Broadcast
and Conversation
channels. Calling banUsers()
or unBanUsers()
on these channels will result in an error.
Flag and Unflag a channel user
While having moderators surveying your chats is great, this doesn't scale well. A way to overcome this is to let your users do the work for your moderators: by letting users report other users or specific messages, the work of moderators goes from scanning each message in each channel to investigate each user report (to both users and messages) and react only when deemed necessary.
In order to report a user, create an instance of EkoUserFlagger
by calling EkoUser.report();
Beware that each EkoUserFlagger
is tied to only one specific user.
To flag a user, call the following method:
To unflag a user, call the following method:
flag and unflag a message
While having moderators surveying your chats is great, it doesn't scale well. A way to overcome this is to let your users do the work for your moderators. By letting users flag other users or specific messages, the work of moderators is significantly reduced and democratized, thus allowing administrators to only respond to issues when deemed critical or absolutely necessary.
In order to flag a message, create an instance of EkoMessageFlagger
by calling EkoMessage.report();
Beware that each EkoMessageFlagger
is tied to only one specific message.
To flag a message, call the following method:
To unflag a message, call the following method:
The User can also check if they have previously flagged a message before by calling the following asynchronous method:
If this method has been called before in the current session, the user can also check the cached result on the message payload itself.
Moderation is an important feature for building a safe community that encourages user participation and engagement.
Amity’s customer centric nature ensures that security needs are kept at the forefront of the work we do. Our purpose has been to continuously develop features that are safe and ready to use. We power our moderators with tools to control and impose permissions that make their applications a safer place, for all users. We put the utmost importance on giving power to our clients to implement protocols that keep their applications healthy, safe and compliant.
When a user is muted, they can not send messages in a channel.
Moderators can mute and unmute users. When a user is muted, they cannot send messages in a channel. However muted users will still be allowed to observe messages in a channel. The status of being muted is indefinite but is only applied at the channel level.
When a user is muted, all messages sent by that user to that channel will be rejected. This method is useful for preventing certain users from sending inappropriate messages, but still allowing them to participate in the conversation in a read-only manner. The timeout property allows you to make the timeout temporary, or permanent by until unset by passing in -1
.
The above logic will mute user1
in the selected channel for 10 minutes.
If you want to permanently mute a user, pass in
Duration.millis(-1)
as thetimeout
. The user will stay muted until you explicitly unmute that user.
To unmute an user, call EkoChannelModeration.unmuteUsers()
:
Note: This feature does not work with Broadcast
and Conversation
channel. Calling muteUsers()
or unMuteUsers()
on these channels will result in an error.