What does real-time message push do?

Source: Internet
Author: User
Keywords Php

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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.