This has been implemented in many websites lets say odesk or so.What I am thinking is Implement a message sending scheme which notifies the user that they have received message.
for example
You send message to me and I would be shown message Red icon from green. Obviously we would need a database table to store sender id receiver Id and so on but how do we implement it in such a way that user does not need to hit refresh button.
I am new to web from c# background so do not know as many ways.
I am developing it in Yii. Few suggestions would be great
You can do this by using a simple periodic refresh javascript method.
Something like this in the view that has the message indicator:
So what is happening is that the setInterval method executes the function every 1000 milliseconds and the function checks for new messages using ajax.
If you don’t know ajax in yii, then check the following for the controller action:
Read more about the timing methods in javascript.
This pattern is also called polling, there are also other popular methods like long polling, and server push, which i’m not very familiar with, but you should check them out too before deciding on a pattern.
Hope this helps, ask for clarifications, if any.