Message Pop Up Ajax Polling(?)
Posted 04 November 2013 - 02:42 PM
If have a question that is related to two different issues I currently have in an application I'm working on.
Issue 1: - There is a message system. Users are able to send each other messages. I would like to have a real time pop up when the user gets a new message and is not on the inbox page.
Issue 2: - I would like to create a basic achievement system, one of the achievements could (for example) be: "Receive a message."
Now I think both functionalities can be achieved through the same way. Anyone of you has any experience with this? I really have no idea where to start. I am completely new with this stuff.
I thought maybe this extension: http://www.yiiframew...tension/yii-nfy could help me out. But after I have installed it, I have no idea where to begin. The documentation is to vague for me to understand.
It would be really great if someone could give me a good starting point.
Thanks a lot for your time.
Posted 04 November 2013 - 03:17 PM
- server checks for new messages for user and return JSON
- client parses JSON and either creates notification / popup / dialog or do nothing
It's pretty simple and can be done w/o any 3rd-party extension.
Or you can use websockets, if you have access to server.
The author of nfy extension is present on this forum, so I think he'll clarify usage details.
Posted 04 November 2013 - 04:45 PM
That extension provides two things:
2. A backend message routing mechanism using database for a simple queue. I modeled it after LogRouter to allow some logic to be applied when handling messages.
To make it work, you need to:
1. Create a channel.
2. Subscribe user to this channel.
3. Send a message, it will be delivered to the user's queue.
4. Read that message (marking it as read) and display it.
The channels are there to support some more complex message routing.