For example, when segmentfault pushes a message, the Bell will have a red number. after the message is clicked, there will be a new message, which can be implemented without refreshing the page or using ajax, what should I do?
For example, segmentfault message push
When there is a message, the Bell will have a red number. after the message is clicked, there will be a new message, which can be implemented without refreshing the page and ajax. what should we do?
Reply content:
For example, segmentfault message push
When there is a message, the Bell will have a red number. after the message is clicked, there will be a new message, which can be implemented without refreshing the page and ajax. what should we do?
Websocket
I used fiddle to check whether socket. io was used.
Tutorial 1 use Node. js + Socket. IO to build a real-time WebSocket application
It should be websocket. you can look at the workerman framework and practice websocket.
Workerman
If you considerphpUpstairs.
Also recommendedpomelo, Distributed and stable, that is, steep curves.
I am working on WEB push recently. I can provide you with some solutions:
Generally, if the real-time requirements for messages are not very high, such as checking a message in 10 seconds is acceptable, then the simplest polling solution can be used, that is, an interface is requested from the server at a certain time to obtain whether unread messages exist. this method is quite simple and has good compatibility with browsers.
There is also a widely used method, that is, webSocket, which has been mentioned before. I will not talk about it more.
HTML5 has a new push standard. SSE (Server-Side Event) can be used for real-time push, which is easier to implement than websocket, but the support for browsers is not very good (modern browsers can support, but IE and Edge are not supported ).
Currently, the mature server push solution is jsonp.