# User channels (/en/realtime-media/rtm/build/work-with-channels/user-channel/windows)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

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 use-cases such as private chats and customer support interactions.

    ## Understand the tech [#understand-the-tech-5]

    To implement point-to-point communication between individual users in your app:

    1. **Set up the Signaling SDK**: [Integrate the Signaling SDK](/en/realtime-media/rtm/quickstart) in your app and [initialize an instance](/en/realtime-media/rtm/quickstart) of the Signaling client.
    2. **Authenticate the user**: [Log in to Signaling](/en/realtime-media/rtm/quickstart) using a unique user ID.
    3. **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.
    4. **Handle incoming messages**: [Listen for message events](/en/realtime-media/rtm/quickstart) to receive messages sent directly to the local user.

    ## Prerequisites [#prerequisites-5]

    Ensure that you have:

    * Integrated the Signaling SDK in your project, and implemented the framework functionality from the [SDK quickstart](/en/realtime-media/rtm/quickstart).

    ## Implement user messages [#implement-user-messages-5]

    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 `RTM_CHANNEL_TYPE_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](/en/realtime-media/rtm/reference/limitations) the frequency at which you can send messages to users.

    Refer to the following sample code for sending messages:

    **String message**

    ```cpp
    // Send string message
    std::string message = "Hello Agora!";
    PublishOptions options;
    options.messageType = RTM_MESSAGE_TYPE_STRING;
    options.customType = "PlainText";
    options.channelType = RTM_CHANNEL_TYPE_USER;

    uint64_t requestId;
    rtmClient->publish("Tony", message.c_str(), message.size(), options, requestId);
    ```

    **Binary message**

    ```cpp
    // Send binary message
    PublishOptions options;
    options.messageType = RTM_MESSAGE_TYPE_BINARY;
    options.customType = "ByteArray";
    options.channelType = RTM_CHANNEL_TYPE_USER;
    char message[5] = {0x00, 0x01, 0x02, 0x03, 0x04};

    uint64_t requestId;
    rtmClient->publish("Tony", message, 5, options, requestId);
    ```

    When you call this method, the SDK triggers the `onPublishResult` callback and returns the API call result.

    ```cpp
    // Asynchronous callback
    class RtmEventHandler : public IRtmEventHandler {
        void onPublishResult(const uint64_t requestId, RTM_ERROR_CODE errorCode) override {
            if (errorCode != RTM_ERROR_OK) {
                // publish message failed
            } else {
                // publish message success
            }
        }
    };
    ```

    <CalloutContainer type="info">
      <CalloutDescription>
        Signaling currently supports only string and binary message formats. To send other types of data such as 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](/en/realtime-media/rtm/build/send-and-receive-messages/message-payload-structuring).
      </CalloutDescription>
    </CalloutContainer>

    ## Reference [#reference-5]

    This section contains content that completes the information on this page, or points you to documentation that explains other aspects to this product.

    ### API reference [#api-reference-4]

    * [`publish`](/en/api-reference/api-ref/signaling#messagepublishpropsag_platform)

    
  
      
  
