wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Does Web Workers can handle Comet streaming Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Does Web Workers can handle Comet streaming" Watch "Does Web Workers can handle Comet streaming" New topic
Author

Does Web Workers can handle Comet streaming

Jitendra Chittoda
Greenhorn

Joined: Jul 21, 2012
Posts: 21

We are using COMET Streaming to send the events(server-push) to the GUI. Is it possible with the WebWorkers to handle that streaming task in a separate thread?
Ido Green
author
Greenhorn

Joined: Jul 27, 2010
Posts: 25
If you are using COMET over XHR I don't see why not...
Web workers contain a limited sets of features but XMLHttpRequest is one of them.
Jitendra Chittoda
Greenhorn

Joined: Jul 21, 2012
Posts: 21

OK, But right now we are using hidden iFrame to implement the COMET. And we are facing the memory problems with the iFrame as it keeps on getting the JS from server and after running the browser say continuously for 2 days causes the browser to crash.
I hope this kind of problem we won't face by using the XHR with Web Workers?
Ido Green
author
Greenhorn

Joined: Jul 27, 2010
Posts: 25
It sounds like you might have a memory leak...
So first I would check the current state of your web app by using Chrome devtools audit tab (or firebug similar option).
Then, you can take your current code that using COMET (on top of XHR) and port it into a worker. You should be fine with it running inside the worker for long-long time.
BTW, it might be good idea to write a 'unit test' that take just the code you wish to run in the worker and test it first on a regular page.
Jitendra Chittoda
Greenhorn

Joined: Jul 21, 2012
Posts: 21

Thanks Green for your feedback. I will certainly look into this issue and going forward will move to WebWorkers over XHR.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Does Web Workers can handle Comet streaming
 
Similar Threads
Global notification method
Pushlets vs AJAX
Too many CLOSE_WAIT s due to AJAX call
Notifying user using JSF after the Asynchronous session bean method completes
Configure Tomcat to run both Comet Pushlets and regular servlet simultaneously