In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is to share with you all kinds of solutions about web message push, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.
In a variety of BS architecture applications, it is often expected that the server can actively push a variety of messages to the client, in order to achieve notifications such as mail, messages, to-do items and so on. The problem with the BS architecture itself is that the server has always used a question-and-answer mechanism. This means that if the client does not actively send a message to the server, the server will not know how to push the message to the client.
Web message push method
With the development of HTML, browser and other technologies and standards, different means and methods have been generated in turn to achieve active push messages on the server side, which are: AJAX,Comet,ServerSent and WebSocket.
The editor will give a straightforward explanation of the various technical means mentioned above.
Web message push means
AJAX
A normal page works like this in a browser:
The user gives the browser an address to access
The browser accesses the server based on this address and creates a TCP connection (HTTP request) with the server.
The server builds a HTML text based on this address and some other data, which will write to the TCP connection, and then close the connection.
The browser gets the HTML text from the server, parses it and presents it to the user on the browser.
At this point, when the user clicks on any one of the sites or triggers any submission:
The browser uses the parameter of form or the parameter of an as the access address
Create a TCP connection with the server
The server builds the HTML text and then closes the connection
The browser destroys the currently displayed page and presents a new page to the user according to the new HTML text.
It is not difficult to find that in the middle of the process, once a connection is established, the page can no longer be maintained. The whole process seems to be a little forced to buy and sell, maybe I just want a new coke, but you have to give me a whole package.
At this point, we can take a look at the XmlHttpRequest component, which allows us to manually create a HTTP request and send the data we want, or the server can only return the results we want. The biggest advantage is that when we receive the response from the server, the original page is not destroyed. It's like, I shouted, "I'm out of coffee, I need a refill," and then the waiter brought a cup of coffee instead of pouring out all my unfinished meals.
The above are the various solutions to web message push, and 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.