Reputation: 13856
I am making messaging application. User1 broadcasts a message
. To other users I need to show how long back, this message was posted. e.g. Posted 9 min. ago. Quite similar to what we see in SO
or facebook.
For this purpose I have started storing message post time, along with message. My plan is to rely on client side clock using javascript to show real time update in the browser.
Is this the way I should go ahead, or there is a better solution out there ?
Upvotes: 0
Views: 156
Reputation: 4350
Check out signalR . It is what you are looking for. And there is also Jabbr built on signalR for chat client.
SignalR supports broadcasting, tries to find out server and client capabilites and use best for case. Supports web sockets, long polling and forever frames etc. If you want to use across multiple servers, it also can use Sql server and Redis as backend.
wiki page : https://github.com/SignalR/SignalR/wiki
By the way, SO uses web sockets for real time updates, https://meta.stackexchange.com/questions/129499/what-technology-framework-is-stackoverflow-using-to-asynchronously-update-client
Upvotes: 2