I would like to ask how to realize a Sina Weibo-like private letter to iPhone Push

  question

Currently, I am working on a social networking website (Thinkphp and mysql). I want to notify other online users when some users trigger some conditions, such as sending a personal letter and a small gift to the other party.

At present, I think the only way is:
Put the message to be sent into redis, and then make a Redis query in the base class Action, so that the user will check whether the Redis has any content for each operation. However, this is not very scientific and belongs to passive query.

Please ask everyone what good methods they have, thank you very much!

https://github.com/walkor/web-msg-sender
This is definitely what you want, implemented by websocket plus workerman.

Demo:
Pages Sending Messages in Backgroundhttp://workerman.net:3333/
The page where the user receives the messagehttp://workerman.net/web-msg-sender.html

Principle: after the user opens the page, the browser will automatically send a websocket connection to the back-end server (the browser supports HTML5 or Flash). the back-end hold these connections. when it wants to push messages to the browser, it can write data to these websocket connections.

Advantages:

  1. Non-polling, high performance, ordinary servers can maintain tens of thousands of connections
  2. Good real-time performance
  3. Compatible with various browsers including ie6 (client supports either flash or html5)