Instant Messaging
Getting Started
Account Integration and Login
Group Chat
Chat Room
Chat Room Tags
Multi-device Login
Statistics Monitoring
Interface Overview
Integrate and Initialize SDK
Basic Messaging
Message History
Message Sending
Message Receiving
Recent Chats
Server Sessions
User Profile
User Relationship
Online Status Subscription
Push and Message Alert
Chat Room
Chat Extension
Miscellaneous Features
Best Practice
Traffic Control in Chat Rooms
API Reference
Status Codes

Traffic Control in Chat Rooms

Update time: 2022/11/03 15:09:54

Due to the traffic control in chat rooms, some messages may get lost when users send a large number of text messages and custom messages (such as gift messages) in a chat room. This document describes how to ensure that custom messages be delivered successfully at message spikes.

Traffic control in chat rooms

  • Traffic control methods

    Two traffic control methods are provided for messaging in chat rooms.

    • For regular messages, users in chat rooms can receive up to 20 messages per second, and the excess will be randomly dropped due to traffic control.
    • For high-priority messages, at most 10 messages are received per second. and the excess part cannot be guaranteed not to be lost.
  • Why traffic control is implemented?

    CommsEase introduced traffic control for the following reasons:

    • A traffic spike in chat rooms may lead to high overhead for client UI rendering. A large number of messages may stop apps from responding. The visual user experience from message refreshing may degrade. Flooding messages are difficult for users to handle and the user experience is compromised.
    • Though servers can scale up and load balancers can handle traffic spikes, a surge in chat room traffic may overload a single server, resulting in slower login to the chat room and increased time-consuming for messaging in the chat room. This also affects the user experience.

    If you have custom requirements, you can request an additional quota for traffic control by contacting our sales manager on CommsEase homepage.

  • Handle regular messages and custom messages that cannot be lost, such as gift messages, as follows:

    • Ordinary messages are sent from clients. For details, see the documents for messaging in chat rooms.
    • Custom messages are sent by calling the Server API (chatroom/sendMsg.action) with the highPriority parameter set to true. In this case, custom messages are sent as high-priority messages. For more information, see Messaging in chat rooms.
  • For gift messages, the following solutions can be used to handle scenarios when the number of gift messages exceeds the upper limit of high-priority messages per second.

    Solution 1 Apply different strategies according to the level of gifts. For example, 5 gifts per second for regular gifts and 5 gifts per second for advanced gifts. The quota of unused advanced gifts can be allocated to regular gifts.
    Solution 2 If the number of regular gifts is high, combine multiple regular gifts into one message for delivery. If the number is still high and the number of combined regular gift messages exceeds the upper limit, some ordinary gift messages will be dropped. If a large number of gifts are flooding chat rooms, users will not notice whether a small amount of regular gift display is lost.
Was this topic helpful?
  • Traffic control in chat rooms
  • Recommended solutions