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.yiiframework.com/extension/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.
It’s my extension. Sorry if the docs aren’t too clear, I’m not good at writing them and I’m not going to pretend I am. I invite you to help me improve it on Github if you manage to get it working.
That extension provides two things:
A widget to fetch and display notifications using WebNotifications JavaScript API (latest HTML5). It uses the simplest ajax polling to periodicaly check for new notifications. It could be replaced with a WebSocket client for more advanced uses.
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:
Create a channel.
Subscribe user to this channel.
Send a message, it will be delivered to the user’s queue.
Read that message (marking it as read) and display it.
The channels are there to support some more complex message routing.