当前位置:网站首页>Supplement the short board - Open Source im project openim about initialization / login / friend interface document introduction
Supplement the short board - Open Source im project openim about initialization / login / friend interface document introduction
2022-06-26 16:05:00 【51CTO】
OpenIM The construction of documents has been far behind the development , It is often criticized by developers , In the next week , We will focus on completing the documents , Make it easier for developers to access . because app sdk The bottom is go To achieve , So this article first writes a template and framework , In the next few minutes , There will be iOS、Android、Flutter、Uniapp、jssdk Colleagues add specific details , And update to the official website

Initialization and login
Initialization and login success callback , Normal use OpenIM The premise of service
SDK | describe |
[Login] | Sign in , If login is successful , You must log out to perform the login operation again |
[Logout] | Log out |
[GetLoginStatus] | Get login status , 101: Login successful , 102: Landing , 103: Login failed , 201: Log out |
[GetLoginUser] | Get the current login user UserID, At this time, the user login status is unknown |
[initSDK] | initialization SDK, Execute once throughout the life cycle , Login related monitoring is introduced as follows : |
OpenIM And the caller use the listening callback mechanism , Exchange information with the caller , The login status is immediately transferred to the caller through asynchronous callback , Ensure that information is delivered in a timely manner without blocking its main thread .
Listening instructions
Log in and listen | Callback description |
[OnConnecting] | Connecting , When connecting to the background ( Including reconnection ) Callback |
[OnConnectSuccess] | Successful connection |
[OnConnectFailed] | The connection fails , If the network connection fails, it will be reconnected , No reconnection in other cases |
[OnKickedOffline] | Kicked offline , It may be caused by the multi terminal login policy , Or the background administrator forces him to log out |
[OnUserTokenExpired] | testing token Overdue callback |
Calling process
OpenIM The call process is divided into the following steps : (1) initialization : Execute once throughout the life cycle (2) Set listening : Including group listening , Friends listen , User monitoring , Message and session listening , These monitoring will be described in other chapters (3) Sign in : Perform other operations after the login callback succeeds , Otherwise, there may be an error that the resource loading is not completed (4) Send and receive messages ;
Friend management interface
OpenIM Provide relationship hosting , For example, friend application , agree! , And friend acquisition ,OpenIM Store friends locally on the client , Combined with the message notification mechanism , Call the background interface on demand , Ensure local and server data consistency . At the same time, the monitoring mechanism is used , Communicate data changes to the caller through asynchronous callbacks .OpenIM When sending and receiving messages , By default, you do not check your friends , You can modify it in the configuration file .OpenIM A good friend relationship is a two-way relationship ,A add to B After being a good friend , be A stay B In my friends list ,B Also in the A In my friends list ,A Delete B, Just delete A 's friends list , and B Your friends list is unaffected . Again , The blacklist is similar . 
SDK | describe |
[GetDesignatedFriendsInfo] | Get the information of the specified friend |
[GetFriendList] | Get a list of all your friends |
[SearchFriends] | Search for friends by keyword |
[CheckFriend] | Check if you are friends |
[AddFriend] | Initiate a friend add request |
[SetFriendRemark] | Set friend notes |
[DeleteFriend] | Delete friends ( One way deletion ) |
[GetRecvFriendApplicationList] | Get the list of add friend applications I received |
[GetSendFriendApplicationList] | Get the application list for adding friends initiated by me |
[AcceptFriendApplication] | Agree to friend application |
[RefuseFriendApplication] | Reject friend application |
[SetFriendListener] | Set up friends 、 Blacklist related monitoring , be used for UI Layer senses data changes in real time and refreshes |
Listening instructions
The function of friend listener : Caller sets friend monitoring , The change of friends' relationship will be through OpenIM The message mechanism synchronizes to online users who need to be aware in real time , Including the other end of the user , The caller performs relevant data processing according to the callback event . Such as user B stay Android Add users at the end A Good friends , user A( All online terminals ) received B Friend application for , be A call GetRecvFriendApplicationList Get the received friend application list , Refresh the interface . meanwhile , user B Other online terminals such as PC The client will also receive the notification ,B call GetSendFriendApplicationList Get the list of initiated friend applications , Refresh B List of friend applications sent out . Of course, you can also use the parameter information of the callback , Do incremental processing , Instead of getting a full list of friend applications . To the user B Apply to add users A For example
Friends and blacklist monitoring | describe |
[OnFriendApplicationAdded] | Friend application list added , Active initiators and passive adders will receive |
[OnFriendApplicationDeleted] | Friend application list delete , Active delegators will receive |
[OnFriendApplicationAccepted] | Friend application is approved , Active initiators and passive adders will receive |
[OnFriendApplicationRejected] | Friend request rejected , Active initiators and passive adders will receive |
[OnFriendAdded] | Friends increase , When users' friends are added, they will receive |
[OnFriendDeleted] | Friend deletion , Users will receive... When their friends are reduced |
[OnFriendInfoChanged] | Friend information changes , User friend information ( Such as nicknames ) When you change, you will receive |
[OnBlackAdded] | Blacklist added , When the user blacklist is added, you will receive |
[OnBlackDeleted] | Remove the blacklist , When the user blacklist is reduced, you will receive |
Project introduction
OpenIM Continue to lead open source IM field , With the support of developers , at present github star breakthrough 9k. In data leakage 、 Information leakage 、 The era of privacy abuse ,IM There is a strong demand for privatization deployment . among , The government and enterprises work together to IM Demand soared , With the iterative upgrading of information technology and the acceleration of the implementation and practice of the information innovation industry , The development potential of collaborative office software will be further released .“ Safe and controllable “ Gradually become the first element . For community dating , More and more privacy and security issues have been exposed , The privatization deployment ensures that the user data is not disclosed . OpenIM From the server to the client SDK Open source instant messaging (IM) Overall solution , Can easily replace third parties IM The cloud service , Create a chat 、 social contact 、 Office function app. !
github Address : https://github.com/OpenIMSDK/Open-IM-Server Developer center :https://doc.rentsoft.cn/#/
OpenIM The team
The founding team comes from senior IM Technical team , We are committed to creating service value with open source technology , Build lightweight 、 Highly available IM framework , Developers simply call SDK, You can build a variety of instant messaging and real-time audio and video interaction scenes in the application .OpenIM advantage : Open source , Security , reliable , Low cost . E-government, which attaches importance to information security , Enterprise collaborative office ,OpenIM They're all very good choices . Since its inception, the company has been “ Open source ” As a core strategy to promote , Open source fully embodies freedom 、 equality 、 Share the spirit of the Internet . OpenIM Invite global technology geeks to participate in technology optimization , Make it easy for developers to integrate , Let every application have IM function , At the same time, consider the access cost of the enterprise 、 Server resources and the most important data security and privacy .
边栏推荐
- Net based on girdview control to delete and edit row data
- The details of the first pig heart transplantation were fully disclosed: human herpes virus was found in the patient, the weight of the heart doubled after death, and myocardial cell fibrosis
- svg野人动画代码
- R语言广义线性模型函数GLM、glm函数构建逻辑回归模型(Logistic regression)、分析模型是否过离散(Overdispersion)、使用残差偏差与二项式模型中的剩余自由度的比率评估
- Big talk Domain Driven Design -- presentation layer and others
- 7 user defined loss function
- TweenMax+SVG切换颜色动画场景
- Transformation of zero knowledge QAP problem
- Net基于girdview控件实现删除与编辑行数据
- 振动式液量检测装置
猜你喜欢

11 introduction to CNN

svg环绕地球动画js特效

Analyse panoramique de la chaîne industrielle en amont, en aval et en aval de la NFT « Dry goods»

SAP OData development tutorial - from getting started to improving (including segw, rap and CDP)

NFT 项目的开发、部署、上线的流程(1)

Stepn novice introduction and advanced

NFT交易原理分析(2)

Beijing University and Tencent jointly build angel4.0, and the self-developed in-depth learning framework "River map" is integrated into the ecology

如何辨别合约问题

Big talk Domain Driven Design -- presentation layer and others
随机推荐
若依如何实现接口限流?
mha 切换(操作流程建议)
NFT 项目的开发、部署、上线的流程(2)
Keepalived 实现 Redis AutoFailover (RedisHA)
Solidus Labs欢迎香港前金融创新主管赵嘉丽担任战略顾问
Angel 3.2.0 new version released! Figure the computing power is strengthened again
NFT Platform Security Guide (2)
5000字解析:实战化场景下的容器安全攻防之道
Net based on girdview control to delete and edit row data
canvas三个圆点闪烁动画
NFT Platform Security Guide (1)
Selenium saves elements as pictures
Summary of data interface API used in word search and translation applications
零知识 QAP 问题的转化
C语言读取数据
7 user defined loss function
Comprehensive analysis of discord security issues
R语言plotly可视化:plotly可视化归一化的直方图(historgram)并在直方图中添加密度曲线kde、并在直方图的底部边缘使用geom_rug函数添加边缘轴须图
1 张量的简单使用
NFT transaction principle analysis (1)