Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying data in real-time on web page [closed]

Tags:

real-time

I'm not sure how to phrase it the best way, but what I'm looking for is a way to display data on a web page as it becomes available. Examples: Displaying IRC channel messages on a web page, as a message is sent to an IRC channel, the message is outputted to the web page at the same time (or with very little delay). Or when data is inserted into database, it is outputted to a web page at the same time (again, or with very little delay). How is such a feature implemented? Can such a feature be implemented with JS/JQuery? I'm assuming yes since that's how Mibbit seems to work (AJAX). An example or pseudo-code explanation would be appreciated since I have absolutely no idea where to even start and what I need.

like image 636
TheMagician Avatar asked Oct 22 '09 23:10

TheMagician


People also ask

How to show real time data on website in asp net?

Server => Client | Here's the entire contents of the ContentPanel. +10s Client => Server | Run the page lifecycle, send me the contents of the ContentPanel. Server => Client | Here's the entire contents of the ContentPanel. +15s Client => Server | Run the page lifecycle, send me the contents of the ContentPanel.

How do you store real time data?

You can use Redis as a buffer, and create a separated worker to save in bulk the data from the buffer to your database. You can build all the components in node. js, take into account the language mix in the example above is to show Dockers capability. Show activity on this post.


1 Answers

The term is Comet, and it's basically just a block of code setup to run forever and poll (send an HTTP request) at intervals to get new data back, if any, populating an existing area with the new data.

You can read more about it:

  • http://en.wikipedia.org/wiki/Comet_%28programming%29

A tutorial ( not the best style of code ):

  • http://www.webreference.com/programming/javascript/rg28/

Stackoverflow question with an example:

  • How do I implement basic "Long Polling"?
like image 198
meder omuraliev Avatar answered Sep 19 '22 02:09

meder omuraliev