User channels
Signaling enables you to send direct, point-to-point messages to individual users through user channels. This feature is useful in one-on-one communication scenarios such as private chats and customer support interactions.
Understand the tech
To implement point-to-point communication between individual users in your app:
- Set up the Signaling SDK: Integrate the Signaling SDK in your app and initialize an instance of the Signaling client.
- Authenticate the user: Log in to Signaling using a unique user ID.
- Send direct messages: Call the
publish
method with the User channel type and specify the recipient's user ID as the channel name to send direct messages. - Handle incoming messages: Listen for message events to receive messages sent directly to the local user.
Prerequisites
Ensure that you have:
- Integrated the Signaling SDK in your project, and implemented the framework functionality from the SDK quickstart.
Implement user messages
This section shows you how to use the Signaling SDK to send messages directly to a specified user.
To send message to a user channel, call the publish
method with the channelType
parameter set to RtmChannelType.USER
and the channelName
parameter set to the target user's userId
. This method enables you to send a message to one user at a time. To send messages to multiple users, call this method for each user. While Signaling does not limit the number of users you can send messages to or receive messages from, it does limit the frequency at which you can send messages to users.
Refer to the following sample code for sending messages:
-
String message
-
Binary message
Signaling currently supports only string and binary message formats. To send other types of data such as a JSON objects, or data from third-party data construction tools such as protobuf, serialize the data before sending the message. For information on how to effectively construct the payload data structure and recommended serialization methods, refer to Message payload structuring.
Reference
This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.
Message packet size
Signaling SDK imposes 32KB size limits on message payload packets sent in user channels. The message payload packet size includes the message payload itself plus the size of the customType
field. If the message payload package size exceeds the limit, you receive the following error message.
To avoid sending failure due to excess message payload packet size, check the packet size before sending.