- Android
- iOS
- JavaScript
- Flutter
- ReactNative
- HarmonyOS
You do not need to create the chatroom with the IM Server API beforehand. The specified chatroom is created automatically when joined, which is useful when a live-room ID is agreed in advance.
After joining, the SDK automatically synchronizes the latest 50 messages and all attribute information in the room locally, then returns them to the business layer through the chatroom listener.
Multi-device sign-in:
Scenario 1: One user can join multiple chatrooms on one device. Messages are isolated and returned through the message listener.
Scenario 2: One user can join multiple chatrooms from multiple devices, such as Web and iOS. Sent and received messages synchronize automatically across devices.
Example
//the join result is delivered through the chatroom listener callback
String chatroomId = "chatroomId1";
int count = 10;
boolean isAutoCreate = true;
JIM.getInstance().getChatroomManager().joinChatroom(chatroomId, count, isAutoCreate);
You do not need to create the chatroom with the IM Server API beforehand. The specified chatroom is created automatically when joined, which is useful when a live-room ID is agreed in advance.
After joining, the SDK automatically synchronizes the latest 50 messages and all attribute information in the room locally, then returns them to the business layer through the chatroom listener.
Multi-device sign-in:
Scenario 1: One user can join multiple chatrooms on one device. Messages are isolated and returned through the message listener.
Scenario 2: One user can join multiple chatrooms from multiple devices, such as Web and iOS. Sent and received messages synchronize automatically across devices.
Example
//the join result is delivered through the chatroom listener callback
NSString *chatroomId = @"chatroomId1";
int count = 10;
BOOL isAutoCreate = YES;
[JIM.shared.chatroomManager joinChatroom:chatroomId
prevMessageCount:count
isAutoCreate:isAutoCreate];
You do not need to create the chatroom with the IM Server API beforehand. The specified chatroom is created automatically when joined, which is useful when a live-room ID is agreed in advance.
After joining, the SDK automatically synchronizes the latest 50 messages and all attribute information in the room locally, then returns them to the business layer through the chatroom listener.
Multi-device sign-in:
Scenario 1: One user can join multiple chatrooms on one device. Messages are isolated and returned through the message listener; distinguish them by
message.conversationId.
Scenario 2: One user can join multiple chatrooms from multiple devices, such as Web and iOS. Sent and received messages synchronize automatically across devices.
Parameters
| Name | Type | Required | Default | Description | Version |
|---|---|---|---|---|---|
| chatroom | Object | Yes | None | Chatroom object. | 1.6.0 |
| chatroom.id | String | Yes | None | Chatroom ID. | 1.6.0 |
| chatroom.count | Number | Yes | None | Number of latest messages to retrieve after joining, returned through the message listener. Range: 1-50. | 1.6.0 |
Example
let chatroom = {
id: 'chatroom1001',
count: 10,
};
jim.joinAndCreateChatroom(chatroom).then(() => {
console.log('join chatroom successfully');
}, (error) => {
console.log('error', error);
});
You do not need to create the chatroom with the IM Server API beforehand. The specified chatroom is created automatically when joined, which is useful when a live-room ID is agreed in advance.
After joining, the SDK automatically synchronizes the latest 50 messages and all attribute information in the room locally, then returns them to the business layer through the chatroom listener.
Example
String chatroomId = "chatroomId1";
int count = 10;
bool isAutoCreate = true;
await JuggleIm.instance.getChatroomManager().joinChatroom(chatroomId, count, isAutoCreate);
You do not need to create the chatroom with the IM Server API beforehand. The specified chatroom is created automatically when joined, which is useful when a live-room ID is agreed in advance.
After joining, the SDK automatically synchronizes the latest 50 messages and all attribute information in the room locally, then returns them to the business layer through the chatroom listener.
Example
import JuggleIM from 'juggleim-rnsdk';
const chatroomId = "chatroomId1";
const count = 10;
const isAutoCreate = true;
await JuggleIM.joinChatroom(chatroomId, count, isAutoCreate);
You do not need to create the chatroom with the IM Server API beforehand. The specified chatroom is created automatically when joined, which is useful when a live-room ID is agreed in advance.
After joining, the SDK automatically synchronizes the latest 50 messages and all attribute information in the room locally, then returns them to the business layer through the chatroom listener.
Example
let chatroomId = "chatroomId1";
let count = 10;
let isAutoCreate = true;
JuggleIm.instance.getChatroomManager().joinChatroom(chatroomId, count, isAutoCreate);