•9 months ago
It's common in chat apps to encounter users who engage in disruptive behavior such as trolling or even scamming, especially as the chat community grows in user count. Stream Chat already provides many moderation tools to help you deal with these problematic users in specific ways.
Stream Chat recently gained a new moderation tool to help you take care of your community, the IP ban. It comes as a new parameter to the regular ban function and is available only at the app level, applying to all channels.
With this new feature, Stream Chat will automatically block access of users who connect with the last known IP address of an IP banned user. That makes it more challenging to create throw-away accounts to engage in offending behavior without being punished or to circumvent a ban.
The IP ban can only be set from the backend and will be in place until it's explicitly removed or reaches its timeout specified in seconds. It's a good idea to set timeouts for IP bans to avoid banning public or shared networks for an indefinite amount of time.
IP Banning A User
To IP ban a user, use the following lines of code:
Removing The IP Ban
To remove the IP ban from a user, use the following line of code:
We're delighted to bring yet another tool to allow communities powered by Stream Chat to be safe and pleasant to be a part of. To learn more about all the available moderation tools, including IP ban, see our documentation on moderation tools, image moderation, and block lists.