Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Does Web Workers can handle Comet streaming

 
Jitendra Chittoda
Greenhorn
Posts: 21
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
Eclipse IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
Eclipse IDE Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Green for your feedback. I will certainly look into this issue and going forward will move to WebWorkers over XHR.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic