当前位置:网站首页>Long awaited full platform support - Open Source im project uniapp update of openim
Long awaited full platform support - Open Source im project uniapp update of openim
2022-07-24 16:31:00 【InfoQ】

Offline plug-in mode
- Download the latestOffline plug-ins
- git clone https://github.com/OpenIMSDK/Open-IM-SDK-Uniapp.git
- Will download the
Tuoyun-OpenIMSDKPut the whole folder uniapp In the root directory of the projectnativepluginsUnder the folder ( If there is no such folder, create a new ).

- open uniapp Project root directory
manifest.jsonfile , openApp Native plug in configuration, Select local plug-ins to import .

- Introduce in the project SDK And listener .
- const openIM = uni.requireNativePlugin("Tuoyun-OpenIMSDK");
- const event = uni.requireNativePlugin("globalEvent");
-
- export { openIM,event }
- Project cloud packaging custom debugging base .

- Start custom debugging base
- You need to select the operation base asCustom debug base

Plug in market cloud plug-in mode
- stay dcloudPlug in marketby uniapp Project binding cloud plug-in .
- After selection, you need to bind the corresponding package name .

- open uniapp Project root directory
manifest.jsonfile , openApp Native plug in configuration, Select the cloud plug-in to import .

- The remaining steps are the sameOffline plug-in mode4-6.
initialization SDK
im.initSDK(operationID, { // operationID It is just a random string Used to locate problems
platform: Platform, // Platform number Refer to the general structure Platform
api_addr: "http://121.37.25.71:10002", // IM API Address
ws_addr: "ws://121.37.25.71:10001", // IM Ws Address
data_dir:"data_dir", // SDK Data storage directory ( Absolute path )
log_level: 6, // SDK The level of logging
object_storage: "minio", // Storage methods of resources such as pictures At present, we support "minio"、"cos"
});
Set listening
im.setUserListener(); // User related monitoring
im.setFriendListener(); // Friend related monitoring
im.setGroupListener(); // Group chat related monitoring
im.setAdvancedMsgListener(); // Message related listening
im.setConversationListener(); // Session related listening
Sign in IM
im.login(
operationID, // operationID It is just a random string Used to locate problems
userID, // user ID Pay attention to this. userID Want to be with token Medium userID Agreement
token, // user token Pay attention to this. token Medium platform To and initialize platform Agreement
(res) => {
if (res.errCode !== 0) {
// Login failed
} else {
// Login successful
}
}
);
Project results

OpenIM What is it?
边栏推荐
- Creation and inheritance of JS class
- MySQL write lock does not take effect
- 在 PHP Web 应用程序中防止 XSS 的最佳实践
- With notes: printing order of synchronous, asynchronous, micro task and macro task
- How to deal with the start and end times in mybatics
- Custom view - Custom button
- Summary of experience in using.Net test framework xUnit, mstest, specflow
- Software recommendation - office software
- Envi SHP to ROI and mask the grid
- MODIS data WGet Download
猜你喜欢
随机推荐
Thinkphp3.2.5 cannot jump to external links
ArcGIS pixel size changed from 0.00025 to meters
图片浏览器?Qt也可以实现!
[LeetCode]75.颜色分类——题解(执行用时击败90% ,内存消耗击败 78%)
Leetcode:162. looking for peak [two points looking for peak]
124 maximum path sum in binary tree
Huawei Kirin 985 mass production in the third quarter: TSMC 7Nm EUV process, integrated 5g baseband!
Qt设计机器人仿真控制器——按键控制机器人关节转动
MySQL write lock does not take effect
Four common post submission methods (application / x-www-form-urlencoded, multipart / form data, application / JSON, text / XML)
After data management, the quality is still poor
deepin任务栏消失解决方法
Quickly view the version of redis in the server
如何在 PHP 中防止 XSS
ARP 入门
我们为什么要推出Getaverse?
[leetcode] day102 spiral matrix II
Telephone system rules
Qt信号和槽连接失败原因及解决办法
Envi SHP to ROI and mask the grid









