Ask for information like Segmentfault.
When the news comes, the little Bell will have a red number, after the opening of a new message, this does not refresh the page can be achieved, and do not have Ajax, how to do?
Reply content:
Ask for information like Segmentfault.
When the news comes, the little Bell will have a red number, after the opening of a new message, this does not refresh the page can be achieved, and do not have Ajax, how to do?
WebSocket
With fiddle looked, it should be used to Socket.io
A tutorial on using Node.js+socket.io to build websocket real-time applications
Should be used WebSocket, you can look at the Workerman framework, practice a bit websocket.
Workerman
If considered php
, the upstairs positive solution.
Also recommended pomelo
, distributed, feel also relatively stable, is the curve is relatively steep.
About web push just what I've been doing recently, can give you some options:
In general, if the real-time requirements for the message is not particularly high, such as 10 seconds to check the message is also acceptable, then you can use the simplest polling scheme, that is, every time to the server to request an interface to get unread messages, this method is quite simple to implement. and the browser compatibility is very good.
There is a way to be widely used, that is, what is said upstairs, using WebSocket, the front has been said a lot, I do not speak more.
HTML5 has a new push standard, SSE (Server-side Event), can be used to do real-time push, relatively websocket to achieve more simple, but the browser support is not too good (modern browser can support, but IE and edge of the whole system does not support).
The current mature server push scenario is JSONP