全球节点部署,提供覆盖超过全球200 多个国家和地区的高质量实时云信令服务
高可靠设计,多机房多路保活机制,在 70% 丢包的弱网环境下,也能保证消息达到率
全球海量数据分发与状态同步延迟 < 100ms(99分位值),同区域往返延迟 < 50ms
并发人数无上限,支持超过 1000 亿级消息并发能力,单频道支持 100 万并发
提供超过 99.99% 正常运行时间 SLA 保证,非常可靠且可用
提供内容审核、实时翻译、云存储、消息推送、Chatbot 等丰富的三方插件
通过声网水晶球,可提供实时数据监控、告警、分析与洞察功能
多种安全加密手段,符合 GDPR、CCPA、COPPA 等全球性隐私安全法规要求
我们重视 API 的易用性,并为各种场景应用提供广泛的教程。这就是我们的客户通常在几天内完成集成上线,而选择其他产品方案往往需要数月
const { RTM } = AgoraRTM
const appId = “your_appId”
const userId = “your_userId”
const setupRTM = async () => {
try {
const rtm = new RTM(appId, userId)
rtm.addEventListener(“message”, event => {
console..log(event.publisher,event.message)
})
const result1 = awaitrtm.login()
const result2 = await rtm.subscribe(“Room1” )
await publishMessage(“Hello,World” )
} catch (status){}
const publishMessage = async (message) => {
try {
const result = await rtm.publish(“Room1”, message)
console..log(result)
await publishMessage(“Hello,World” )
} catch (status){
console..log(status)
}
window.onload = setupRTM
public class EventHandler implements RtmEventListener {
@Override
public void onMessageEvent ( MessageEvent event ) {}
}
String appId = “your_appId”
String userId = “your_userId”
RtmConfig rtmConfig = new RtmConfig.Builder( appId, userIdeventListener(new EventHandler() ).build()
rtmClient = RtmClient.create( rtmConfig )
String token = “your_token”
rtmClient. login ( token, new ResultCallback < Void> () {
@Override
public void onSuccess ( Void responseInfo ) {}
@Override
public void onFailure ( ErrorInfo errorInfo ) {}
})
String channelName = “Room1”
String message = “Hello World”
PublishOptions options = new PublishOptions()
rtmClient. publish ( channelName, message, options, new ResultCallback < Void> () {
@Override
public void onSuccess ( Void responseInfo ) {}
@Override
public void onFailure ( ErrorInfo errorInfo ) {}
})
@interface EvnetHandler : NSObject <AgoraRtmClientDelegate>
@end
@implementation EvnetHandler
– (void)rtmKitAgoraRtmClientKit *)rtmKit didReceiveMessageEvent
AgoraRtmMessageEvent *)event {}
@end
NSString* appId = @“your_appId”
NSString* userId = @“your_userId”
AgoraRtmClientConfig* cfg = [[AgoraRtmClientConfig alloc] initWithAppId : appId userId : userId]
NSError* initError = nil
AgoraRtmClientKit* client = [[AgoraRtmClientKit alloc] initWithConfig : cfg delegate : &initError]
NSString* token = @“your_token”
[ client loginByToken :token completion :^( AgoraRtmCommonResponse * _Nullable response , AgoraRtmErrorInfo * _Nullable errorInfo ) {
if ( errorInfo == nil ) {
} else {
}
}]
publish message
NSString* channelName = @“Room1”
NSString* message = @“Hello World”
[ client publish :message option :nil completion :^( AgoraRtmCommonResponse * response , AgoraRtmErrorInfo* _Nullable errorInfo ) {
if ( errorInfo == nil ) {
} else {
}
}]
#include <mutex>
#include <condition_variable>
#include “IAgoraRtmClient.h”
using namespace std;
using namespace agora::rtm;
static const char* kAppName = “[rtm-demo]”;
mutex mtx;
condition_variable cv;
bool ready = false;
class RtmEventHandler : public IRtmEventHandler {
public:
void onMessageEvent(const IRtmEventHandler::MessageEvent &event) override {
printf(“%s: message event: %s \r\n”, kAppName, event.message);
}
void onLoginResult(RTM_ERROR_CODEerrorCode) override {
printf(“%s: login with error code: %d \r\n”, kAppName, errorCode);
if (errorCode == RTM_ERROR_OK) {
std ::unique_lock<std::mutex> lck(mtx);
ready = true;
cv.notify_all();
}
}
};
private string appId = “your_appId”
private string userId = “your_userId”
private string channelName = “ROOM1”
private IRtmClient rtmClient
public void Awake()
{
Initialize()
}
public async void Initialize()
{
RtmConfig config = new RtmConfig()
config.appId = appId
config.userId = userId
try {
rtmClient = RtmClient. CreateAgoraRtmClient . (config)
} catch (RTMException e) {
}
rtmClient. OnMessageEvent += OnMessageEvent
SubscribeOptions subscribeOptions = new SubscribeOptions ()
var result1 = await rtmClient. SubscribeAsync( channelName, subscribeOptions)
PublishOptions publishOptions = new PublishOptions ()
var result2 = await rtmClient. PublishAsync( channelName, “Hello,World” , subscribeOptions)
}
private void OnMessageEvent( MessageEvent eve)
{
Debug. Log( string. Format ( “Received message:{0} from :{1} “, eve. publisher, eve. message ))
}