In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how to access im instant messaging capabilities in web-based business systems. The editor thinks it is very practical, so I share it with you. I hope you can learn something after reading this article. Let's take a look at it with the editor.
Access demand
The internal system of the enterprise needs to add instant messaging function to enable employees to communicate better! There are the following requirements:
It is hoped that the enterprise communication information and data will be stored within the enterprise.
Only Web version of the internal system of the enterprise
I don't want major changes to the enterprise system.
Of course, it is also convenient to access mobile applications, but it is outside the scope of this case.
Prepare for
Procedure:
The first step is to deploy the data server, see help
Then download the SDK on Web and configure it. See help.
Please put the y2wIMWeb folder in your project to ensure that the web pages of this folder are accessible directly. It is recommended that you do not change the folder name yet.
For your business page, please load the following files:
Y2wIMWeb/web/js/3rd/md5.js .
Y2wIMWeb/web/js/3rd/jquery-1.7.1.min.js . If the page already references JQuery, you don't have to add this.
Y2wIMWeb/web/js/y2wIMWeb.js . Please change the data server address config.baseUrl = 'http://112.74.210.208:8080/v1/'; on line 1323, and keep / v1 / when you change
Several simple operations to bind users synchronously
There are two ways to keep business system users consistent with instant messaging users:
For registration of calling WebSDK, see help
Just call the RESTful Api of the data server, open the help, and find / users/register.
Create a group
That is, to create a Session whose type is group, there are two ways to do this:
To call the creation group of WebSDK, see add session in help
Directly in the call to the RESTful Api of the data server, open the help and find the POST method of / sessions.
Add people to the group
There are two ways to add users to the created Session to chat. You can choose one of them:
Note: the required userId here is the id returned by the synchronously bound user.
To call WebSDK, see add session members in help
Directly in the RESTful Api of the data server, open the help and find the POST method of / sessions/ {sessionId} / members.
User login
When a user is bound and registered, you need to log in to token to continue other operations. There are two ways to do this:
Users who call WebSDK log in, see help, note that when performing this operation in the business system, do not jump to the page
Directly in the call to the RESTful Api of the data server, open the help and find the POST method of / users/login.
Get the number of unread messages from the user
Get how many unread messages the user has left to remind you. There are two ways to do this, one of which is optional:
The user logs in. See you up there.
Gets a list of user sessions. Open help and find the GET method of / users/ {userId} / userConversations.
Iterate through the list of user sessions and count the unread property of the session, that is, the number of messages that have not been read.
The user logs in. See you up there.
User session initialization. See help
Synchronize user sessions. See help
Gets a list of user sessions. See help, where type takes undefined
Iterate through the list of user sessions and count the unread property of the session, that is, the number of messages that have not been read.
WebSDKRESTFul Api business steps
To add chat entry to the business page, you need to do:
When the web page opens, determine whether the user has registered the synchronization user IM, and if not, register the synchronization user
Login user
Get the number of unread messages for this same household
When the user clicks on this button, open the URL y2wIMWebUBG _ main.htmlpromotargetID = {targetId} & type= {type} to enter the chat. Where targetId is SessionId, that is, the group Id;type can be filled in ['p2pads], which defaults to group.
At this point, the docking is completed.
.net access RESTful Api library
If you use C# calls, you can download this help library file. Here is an example of how to use it:
Copy
Var resText = Y2W.Lib.ApiRequest.OpenPost ("http://{ServerAddress}/v1/users/register") .SetPostParm (" password "," 121") .SetPostParm ("name", "wfwfw") .SetPostParm ("email", "abc@liwef.com") .SetToken ("token") .ExectText () above is how to access the im instant messaging capability in the web business system. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.