@rongcloud/react-native-im-wrapper
TypeScript icon, indicating that this package has built-in type declarations

5.6.2 • Public • Published

rongcloud-react-native-im-wrapper npm version

融云 React Native IMLib 是以 IMLib SDK 5.2.5 版本为基础实现的开源项目,支持 Android、iOS,开发者在集成使用过程中如遇到问题可提交到 GitHub 的 Issues 中,融云技术支持人员会在 1 个工作日内回复问题,谢谢您对融云的理解与支持。

文档

用法

创建引擎

import { RCIMIWEngine, RCIMIWEngineOptions } from "@rongcloud/react-native-im-wrapper";
let appKey='your appkey'
let options : RCIMIWEngineOptions = {}
let engine = RCIMIWEngine.create(appKey, options);

连接融云服务

let token = 'your token'
let promise = engine.connect(token, 0)
promise.then(code => {
//
})

监听消息

engine.setOnMessageSentListener((code, message) => {
    
})

发送消息

let conversationType = RCIMIWConversationType.PRIVATE
let targetId = 'your targetId'
let channelId = ''
let text = 'Hello World'
let promise : Promise<RCIMIWTextMessage> = engine.createTextMessage(conversationType, targetId:, channelId, text):
promise.then(message =>{
  engine.sendMessage(message).then(code => {
    //
  })
})

更多示例请参考 examples

运行示例

yarn

# android
yarn example android

# ios
yarn example ios

项目结构

├── android (Android 接口实现)
├── docs (接口文档)
├── example (React Native 示例)
├── ios (iOS 接口实现)
└── src (接口实现)

Package Sidebar

Install

npm i @rongcloud/react-native-im-wrapper

Weekly Downloads

2

Version

5.6.2

License

MIT

Unpacked Size

12.6 MB

Total Files

177

Last publish

Collaborators

  • rongcloud-multi-platform
  • cloudregister
  • knight1cy
  • congk