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
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
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 .

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
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 .
原网站版权声明
本文为[InfoQ]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206261603165225.html