当前位置:网站首页>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基于girdview控件实现删除与编辑行数据
- Handwritten numeral recognition, run your own picture with the saved model
- Practice of federal learning in Tencent micro vision advertising
- Redis顺序排序命令
- [problem solving] the loading / downloading time of the new version of webots texture and other resource files is too long
- 我想知道如何通过线上股票开户?在线开户安全么?
- 基于 MATLAB的自然过渡配音处理方案探究
- Swiftui retrieves the missing list view animation
- LeetCode 单周赛298,前三题
- Ten thousand words! In depth analysis of the development trend of multi-party data collaborative application and privacy computing under the data security law
猜你喜欢

SVG大写字母A动画js特效

Solana capacity expansion mechanism analysis (1): an extreme attempt to sacrifice availability for efficiency | catchervc research

js创意图标导航菜单切换背景色

SAP OData 开发教程 - 从入门到提高(包含 SEGW, RAP 和 CDP)

svg野人动画代码

C# 读写文件从用户态切到内核态,到底是个什么流程?

NFT contract basic knowledge explanation

10 tf. data

svg环绕地球动画js特效

2 三种建模方式
随机推荐
Leetcode one week race 298, first three questions
Canvas three dot flashing animation
5 模型保存与加载
8 user defined evaluation function
简单科普Ethereum的Transaction Input Data
Panoramic analysis of upstream, middle and downstream industrial chain of "dry goods" NFT
SVG大写字母A动画js特效
基于 MATLAB的自然过渡配音处理方案探究
大话领域驱动设计——表示层及其他
svg canvas画布拖拽
Unlock the value of data fusion! Tencent angel powerfl won the "leading scientific and Technological Achievement Award" at the 2021 digital Expo
首例猪心移植细节全面披露:患者体内发现人类疱疹病毒,死后心脏重量翻倍,心肌细胞纤维化丨团队最新论文...
Ideal path problem
canvas三个圆点闪烁动画
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
NFT transaction principle analysis (2)
10 tf. data
8 自定义评估函数
This year, the AI score of college entrance examination English is 134. The research of Fudan Wuda alumni is interesting
Tweenmax+svg switch color animation scene