Push values from web server to client every 20ms (Java MVC)

I am new to Java. I am trying to write something on lines of MVC where my web server has a java method that reads a text file one row at a time every 20 milliseconds and I want to send (/push) this value to client every 20 milliseconds (that is at the same instant as the new row is read from CSV). I have read this http://en.wikipedia.org/wiki/Comet_%28programming%29 But being very new to all this could not understand much. How push/pull/streaming works and what to use here. Moreover if I should be pulling or pushing values here. I think I should push else server will be clogged by so many pull requests every 20ms. Please suggest. Any piece of code will be a great great help.


You cannot push data from Web server to client/browser as client machines firewall will block any kind of connection you try to make with machine. Browser has always need to pull it from server.

You can virtually achieve this by using reverse ajax using long lived HTTP connection from Javascript/Ajax

Please refer to following link for the example


Push would seem to be the best answer here, though you may have some issues getting everything to work on a 20ms round-trip without falling behind, unless this is all going to work on a local network.

The currently-emerging state of the art for push seems to be HTML5 WebSockets. If you can ensure use of the latest web browsers that have support for it, I would suggest going with that.

Here is an example of building a simple WebSocket app.

Need Your Help

Help Deadlock analysis

static deadlock crt

The Deadlock occurs in my application when initialization of local static variable happens in the function called from DLLMain Entry point with param DLL_THREAD_DETACH.

SecurityException thrown when app starts from remote folder

.net security

I have an app written in C# that lies on a network share. When I run it from a local drive, everything works fine. When I start it from the remote share, calls like

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.