超过10亿
月活跃用户数
超过5,500亿
每日消息上限
100,000 +
全球用户
99.99%+
消息成功率
Use In-app Chat Features to Drive Higher Engagement
仅需要几行代码就能告别繁忙工作
JavaScript
Android
iOS/Mac
Flutter
RN
Unity
Electron
C
// create an instance of the chat SDK
let chat = TencentCloudChat.create({
SDKAppID: 0
});
// login
chat.login({userID: 'your userID', userSig: 'your userSig'});
// This event is triggered when the SDK receives a newly pushed one-to-one message, group message, group notification, or group system message
let onMessageReceived = function(event) {
// event.data - An array that stores the Message objects - [Message]
};
chat.on(TencentCloudChat.EVENT.MESSAGE_RECEIVED, onMessageReceived);
// create a text message
let message = chat.createTextMessage({
to: 'user1',
conversationType: TencentCloudChat.TYPES.CONV_C2C,
payload: {
text: 'Hello world!'
}
});
// send message
let promise = chat.sendMessage(message);
promise.then(function(imResponse) {
console.log(imResponse);
}).catch(function(imError) {
console.warn('sendMessage error:', imError);
});
// logout
chat.logout();