-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signaling updates + User channel doc (#1569)
* updates * updates * review updates --------- Co-authored-by: saudsami <[email protected]>
- Loading branch information
1 parent
f57095f
commit b677cc1
Showing
21 changed files
with
420 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ In some environments with restricted network services, you may need to set up a | |
```java | ||
RtmProxyConfig proxyConfig = new RtmProxyConfig() | ||
|
||
|
||
// Set proxy type as HTTP. | ||
proxyConfig.proxyType = RtmProxyType.HTTP; | ||
// Set your proxy server address. | ||
|
@@ -66,6 +67,23 @@ RtmConfig rtmConfig = new RtmConfig.Builder("appid", "userId") | |
To deploy a private environment, you need to set up the backend service. For assistance, please contact [technical support](mailto:[email protected]). | ||
</Admonition> | ||
|
||
|
||
### Connection protocol | ||
|
||
To ensure connection stability and continuous service availability, the RTM client establishes two transmission links for each service (message channel and stream channel) when connecting to the edge server. By default, these links use the TCP and UDP protocols, respectively. This design ensures that network issues on one link do not affect the overall transmission. Compared to other WebSocket-based message transmission solutions, RTM's redundant link design maximizes transmission stability and message delivery rate. | ||
|
||
In some cases, users may find that their network does not support UDP port transmission, either temporarily or permanently. To ensure the dual-link design operates effectively, the SDK allows users to configure both links to use the TCP protocol. This can be done by setting the `protocolType` field in the `RtmConfig`. Below is a code example that configures both links to use the TCP protocol: | ||
|
||
```java | ||
RtmConfig rtmConfig = new RtmConfig.Builder("appid", "userId") | ||
.protocolType(RtmProtocolType.TCP_ONLY) | ||
.build(); | ||
``` | ||
|
||
<Admonition type="alert" info="info"> | ||
The SDK does not support configuring both links to use the UDP protocol simultaneously. | ||
</Admonition> | ||
|
||
### Log configuration | ||
|
||
In the development and testing phase of your <Vpl k="CLIENT" />, you may need to output more detailed information to locate and fix problems. Enable log output of the SDK and set the log information level by configuring `RtmLogLevel` when initializing the <Vg k="SIG" /> client instance. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,22 @@ private_config.serviceType = AgoraRtmServiceTypeStream | AgoraRtmServiceTypeMess | |
To deploy a private environment, you need to set up the backend service. For assistance, please contact [technical support](mailto:[email protected]). | ||
</Admonition> | ||
### Connection protocol | ||
To ensure connection stability and continuous service availability, the RTM client establishes two transmission links for each channel (message channel and stream channel) when connecting to the edge server. By default, these links use the TCP and UDP protocols respectively. This design ensures that network issues in one link do not affect transmission performance. Compared to other WebSocket-based message transmission solutions, RTM's redundant link design maximizes transmission stability and message arrival rates. | ||
In some cases, users may find that their network does not support UDP port transmission, either temporarily or permanently. To ensure the dual-link design functions effectively, the SDK allows users to configure both links to use the TCP protocol by setting the `protocolType` field in the `AgoraRtmClientConfig`. Here is an example of configuring both links to use the TCP protocol: | ||
```objc | ||
AgoraRtmClientConfig* rtm_config = [[AgoraRtmClientConfig alloc] initWithAppId:@"your_appid" userId:@"your_userid"]; | ||
rtm_config.protocolType = AgoraRtmProtocolTypeTcpOnly; | ||
``` | ||
<Admonition type="alert" info="info"> | ||
The SDK does not support configuring both links to use the UDP protocol simultaneously. | ||
</Admonition> | ||
|
||
|
||
|
||
### Log configuration | ||
|
||
In the development and testing phase of your <Vpl k="CLIENT" />, you may need to output more detailed information to locate and fix problems. Enable log output of the SDK and set the log information level by configuring `AgoraRtmLogLevel` when initializing the <Vg k="SIG" /> client instance. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import ProjectImplement from '@docs/shared/signaling/user-channel/project-implementation/index.mdx'; | ||
import Reference from '@docs/shared/signaling/user-channel/reference/index.mdx'; | ||
import NotAvailable from '@docs/shared/common/not-available.mdx'; | ||
|
||
<PlatformWrapper platform="[android,ios,macos]"> | ||
<Vpd k="NAME" /> 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 <Vpl k="CLIENT"/>: | ||
|
||
1. **Set up the <Vpd k="SDK" />**: [Integrate the <Vpd k="SDK" />](../get-started/sdk-quickstart#integrate-the-sdk) in your app and [initialize an instance](../get-started/sdk-quickstart#initialize-the-signaling-engine) of the <Vpd k="NAME" /> client. | ||
2. **Authenticate the user**: [Log in to <Vg k="SIG" />](../get-started/sdk-quickstart#log-in-to-signaling) 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](../get-started/sdk-quickstart#add-an-event-listener) to receive messages sent directly to the local user. | ||
|
||
## Prerequisites | ||
|
||
Ensure that you have: | ||
|
||
* Integrated the <Vpd k="SDK" /> in your project, and implemented the framework functionality from the [SDK quickstart](../get-started/sdk-quickstart). | ||
|
||
## Implement user messages | ||
|
||
This section shows you how to use the <Vpd k="SDK" /> to send messages directly to a specified user. | ||
|
||
<ProjectImplement/> | ||
|
||
<Admonition> | ||
<Vg k="SIG" /> 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](../best-practices/message-payload-structuring). | ||
</Admonition> | ||
|
||
## Reference | ||
|
||
This section contains information that completes the information in this page, or points you to documentation that explains other aspects to this product. | ||
|
||
<Reference/> | ||
</PlatformWrapper> | ||
|
||
<PlatformWrapper notAllowed="[android, ios, macos]"> | ||
<NotAvailable /> | ||
</PlatformWrapper> | ||
|
48 changes: 48 additions & 0 deletions
48
shared/signaling/user-channel/project-implementation/android.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<PlatformWrapper platform="android"> | ||
|
||
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 <Vg k="SIG" /> does not limit the number of users you can send messages to or receive messages from, it does [limit](../reference/limitations#message-channel) the frequency at which you can send messages to users. | ||
|
||
Refer to the following sample code for sending messages: | ||
|
||
- String message | ||
|
||
```java | ||
// Send string message | ||
PublishOptions options = new PublishOptions(); | ||
options.setChannelType(RtmChannelType.USER); | ||
options.setCustomType("PlainText"); | ||
rtmClient.publish("Tony", "Hello world", options, new ResultCallback<Void>() { | ||
@Override | ||
public void onSuccess(Void responseInfo) { | ||
log(CALLBACK, "Send message success"); | ||
} | ||
|
||
@Override | ||
public void onFailure(ErrorInfo errorInfo) { | ||
log(ERROR, errorInfo.toString()); | ||
} | ||
}); | ||
``` | ||
|
||
- Binary message | ||
|
||
```java | ||
// Send binary message | ||
byte[] message = new byte[] {1, 2, 3, 4}; | ||
PublishOptions options = new PublishOptions(); | ||
options.setChannelType(RtmChannelType.USER); | ||
options.setCustomType("ByteArray"); | ||
rtmClient.publish("Tony", message, options, new ResultCallback<Void>() { | ||
@Override | ||
public void onSuccess(Void responseInfo) { | ||
log(CALLBACK, "Send message success"); | ||
} | ||
|
||
@Override | ||
public void onFailure(ErrorInfo errorInfo) { | ||
log(ERROR, errorInfo.toString()); | ||
} | ||
}); | ||
``` | ||
|
||
</PlatformWrapper> |
11 changes: 11 additions & 0 deletions
11
shared/signaling/user-channel/project-implementation/index.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Android from './android.mdx' | ||
import ObjC from './obj-c.mdx' | ||
import LinuxCpp from './linux-cpp.mdx' | ||
import Web from './web.mdx' | ||
import Unity from './unity.mdx' | ||
|
||
<Android /> | ||
<ObjC /> | ||
<LinuxCpp /> | ||
<Web /> | ||
<Unity /> |
4 changes: 4 additions & 0 deletions
4
shared/signaling/user-channel/project-implementation/linux-cpp.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<PlatformWrapper platform="linux-cpp"> | ||
|
||
|
||
</PlatformWrapper> |
45 changes: 45 additions & 0 deletions
45
shared/signaling/user-channel/project-implementation/obj-c.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<PlatformWrapper platform="ios, macos"> | ||
|
||
In a user channel, you send a point-to-point message to a specified user by calling the `publish` method. Set the `channelType` parameter to `AgoraRtmChannelTypeUser` and the `channelName` parameter to the user ID of the specified user. This method enables you to send messages to one user at a time. To send messages to multiple users, call this method multiple times. While <Vg k="SIG" /> does not limit the number of users you can send messages to or receive messages from, it does [limit](../reference/limitations#message-channel) the frequency at which you can send messages to users. | ||
|
||
Refer to the following sample code for sending messages: | ||
|
||
- String message | ||
|
||
```objc | ||
// Send string message | ||
NSString* message = @"Hello Agora!"; | ||
NSString* user = @"Tony"; | ||
|
||
AgoraRtmPublishOptions* publish_option = [[AgoraRtmPublishOptions alloc] init]; | ||
publish_option.channelType = AgoraRtmChannelTypeUser; | ||
|
||
[rtm publish:user message:message option:publish_option completion:^(AgoraRtmCommonResponse * _Nullable response, AgoraRtmErrorInfo * _Nullable errorInfo) { | ||
if (errorInfo == nil) { | ||
NSLog(@"publish success!!"); | ||
} else { | ||
NSLog(@"publish failed, errorCode %d, reason %@", errorInfo.errorCode, errorInfo.reason); | ||
} | ||
}]; | ||
``` | ||
- Binary message | ||
```objc | ||
// Send string message | ||
NSString* message = @"Hello Agora!"; | ||
NSString* user = @"Tony"; | ||
|
||
AgoraRtmPublishOptions* publish_option = [[AgoraRtmPublishOptions alloc] init]; | ||
publish_option.channelType = AgoraRtmChannelTypeUser; | ||
|
||
[rtm publish:user message:message option:publish_option completion:^(AgoraRtmCommonResponse * _Nullable response, AgoraRtmErrorInfo * _Nullable errorInfo) { | ||
if (errorInfo == nil) { | ||
NSLog(@"publish success!!"); | ||
} else { | ||
NSLog(@"publish failed, errorCode %d, reason %@", errorInfo.errorCode, errorInfo.reason); | ||
} | ||
}]; | ||
``` | ||
</PlatformWrapper> |
Oops, something went wrong.