An instant messaging SDK product is a software development kit that provides interfaces and functionalities for building and integrating real-time messaging features, enabling developers to implement instant messaging services within their applications.
_English | Chinese_
_Update time: 2024-12-19_
- Introduction to ChatSDK
- Development environment requirements
- Integrate ChatSDK
- Quick start
- Contributing
- License
An Instant Messaging SDK (Software Development Kit) is a collection of tools, libraries, and APIs designed to integrate real-time messaging capabilities into applications. It allows developers to easily add text, voice, and video communication features into mobile apps, websites, or other platforms without having to build the communication infrastructure from scratch.
- MacOS 12 or higher
- React-Native 0.66 or higher
- NodeJs 16.18 or higher
For iOS app:
- Xcode 13 or higher and its related dependency tool.
For the Android app:
- Android Studio 2021 or higher and its related dependency tool.
``sh`
npm install react-native-shengwang-chator
yarn add react-native-shengwang-chat
1. Initialize SDK
`typescript`
// Please use appkey or appId for initialization.
const appKey = '
const appId = '
ChatClient.getInstance()
.init(
appKey !== undefined
? ChatOptions.withAppKey({
appKey: appKey,
autoLogin: false,
})
: ChatOptions.withAppId({
appId: appId,
autoLogin: false,
})
)
.then(() => {
console.log('initialization success');
})
.catch((reason) => {
console.error(reason);
});
2. Connect to server
`typescriptlogin success
// Connect to server
const userId = '
const userToken = '
ChatClient.getInstance()
.loginWithToken(userId, userToken)
.then((value) => {
console.log(, value);`
})
.catch((reason) => {
console.error(reason);
});
3. Send message
`typescriptsend success
// Send a message
ChatClient.getInstance()
.chatManager.sendMessage(message, {
onError: (localMsgId: string, error: ChatError) => {
console.error(error);
},
onSuccess: (message: ChatMessage) => {
console.log(, message);``
},
})
.catch((reason) => {
console.error(reason);
});
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT