We apologize for the inconvenience of this page no longer being maintained. For the latest product information, please visit our current product introduction page. >>

Chat Room Tags

Update time: 2024/10/17 10:03:47

Overview

The chat room feature can help you to build a chat room in your app. Chat rooms are suitable for social entertainment, live streaming in education. By default, messages in a chat room are delivered to all online members in the chat room. From v8.4.0, chat room tags are supported. You can send messages to tagged members in chat rooms. Tags can also be applied to tagged messages.

Scenarios

Breakout classroom

Combine large-scale classroom and breakout classroom. When one teacher is leturing, the students can be divided into several small classes. Teachers manage and interact with students in small classrooms. This method can balance the cost of large-scale classrooms and the teaching effect of breakout classrooms.

The previous diagram shows a typical breakout classroom:

  • All class members share the same chat room
  • Teachers can send messages to all classes and receive messages from all classes
  • Students can only receive messages within the class, and sent messages can only display within the class
  • The moderators can be configured and can manage one or multiple classes

Chat room for large live streaming events

In a large-scale live chat room, users can be tagged and grouped to achieve the effects of the following scenarios:

  • Multiple artists and stars performs in the same live event, fans of artists and stars can interact internally, fans for different stars do not interact.
  • For sports and e-sports events, viewers can support both side and only interact within the fans of the team.
  • Apply a tag strategy suitable for your application. In the same chat room, users of the same hobby or age group communicate with each other

Features

The tagging of the chat room allows you to implement personalized message sending and receiving by setting tag fields when logging in. The specific process is as follows:

Login

Two parameters are supported for login:

  • The first parameter tags is used to identify which tags the persistent connection of this login belongs to. It is a JSONArray. The same persistent connection supports up to 10 tags, and each tag can have a maximum of 32 characters, such as: ["abc", "def"].

  • The second parameter notifyTargetTags is a tag expression, indicating which tag users should be broadcast to notifications for joining and leaving. If the default value is used, the server will automatically generate a tag expression according to tags. The rule for generating tags is to combine all tags using the and keyword. Only users with combined tags can receive messages.

Send messages using the SDK

The notifyTargetTags parameter is a tag expression specifying the recipient of a message. If unspecified, the notifyTargetTags set during login will be used

Send messages using the server API

The notifyTargetTags parameter is a tag expression specifying the recipient of a message. If unspecified, the message is sent to everyone.

New tag interface

New tag interfaces for SDK interfaces and server APIs are available:

  • Muting or unmuting users with a specified tag. Only the administrator or creator of a chat room can use the interface. All tagged users cannot send messages. For example, if User A is muted, users with tags ["A","B"] cannot send messages.

  • Query the number of online users with specified tags. Note that when the same account is logged in to multiple devices, the count of online users is deemed as 1.

  • Query the list of online members with a specified tag. This interface returns paginated results. For users from multiple devices, this interface will return multiple records.

Tag expression

The tag expression is used to define a target for message delivery in chat rooms. The expressions can be intersected and combined, or selected using regular expression, and applied with priority in the expression with parentheses, similar to arithmetic operations. Each label expression is limited to a maximum of 128 characters.

Some examples of tag expressions:

  1. expression for the abc tag
json{"tag": "abc"}
  1. expression for the abc or def tag
json{"tag": "abc"} or {"tag": "def"}
  1. expression for the abc and def tag
json{"tag": "abc"} and {"tag": "def"}
  1. regular expression for the abc tag
json{"tag": "abc.*", "matchType": "regex"}
  1. regular expression for the abc or def, and 123 or 456 tag
json({"tag": "abc"} or {"tag": "def"}) and ({"tag": ".*123", "matchType": "regex"} or {"tag": "456.*", "matchType": "regex"})
Was this page helpful?
Yes
No
  • Overview
  • Scenarios
  • Breakout classroom
  • Chat room for large live streaming events
  • Features
  • Login
  • Send messages using the SDK
  • Send messages using the server API
  • New tag interface
  • Tag expression