CI3 How to implement server-side message push?

Source: Internet
Author: User
Keywords Php codeigniter websocket
Tags codeigniter

What's the best solution for a recent project that needs to be synced to the mobile side with server-side messages?

The first thing I thought of myself was two solutions:

The first: Ajax polling (obviously not a good way, because the server-side message is an unknown message, and if it keeps polling, even if it's a few seconds apart, the mobile end does not have a polling end, like an infinite loop without terminating the operation)

The second kind: Use WebSocket, in the business need real-time update place to establish a long connection, Google a lot of information, many people on the Web recommend the use of Ratchet, then the question is, has someone used this tool library? What are the similarities and differences between it and the domestic workman? How to choose these two tools ...

Yes, it's important to forget that the project is now based on CI3, so consider the compatibility with CI3.

Here are some of the key things I've been collecting:
http://stackoverflow.com/questions/34389 ...
http://socketo.me/
http://forum.codeigniter.com/thread-6340 ...

Reply content:

What's the best solution for a recent project that needs to be synced to the mobile side with server-side messages?

The first thing I thought of myself was two solutions:

The first: Ajax polling (obviously not a good way, because the server-side message is an unknown message, and if it keeps polling, even if it's a few seconds apart, the mobile end does not have a polling end, like an infinite loop without terminating the operation)

The second kind: Use WebSocket, in the business need real-time update place to establish a long connection, Google a lot of information, many people on the Web recommend the use of Ratchet, then the question is, has someone used this tool library? What are the similarities and differences between it and the domestic workman? How to choose these two tools ...

Yes, it's important to forget that the project is now based on CI3, so consider the compatibility with CI3.

Here are some of the key things I've been collecting:
http://stackoverflow.com/questions/34389 ...
http://socketo.me/
http://forum.codeigniter.com/thread-6340 ...

Real-time two-way communication is definitely with Websocket, but I do not recommend PHP do Websocket server, recommended Nodejs
In addition, if just server push, browser side can use EventSource, this is also a HTML5 standard.

Server-side messages are synced to the mobile side

Synchronization is bidirectional, and you do not see the need for bidirectional synchronization from your description.

Can try third-party push: such as a push, jpush and so on.

If it is bidirectional, you can use WebSocket.

Why not consider asynchronous push? Server-side Once there is a new message to the mobile proactive push, the mobile side has received the message interface can be

  • 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.