HartleySan Posted April 24, 2012 Share Posted April 24, 2012 I'm curious about the best approach to take for asynchronous messaging in JS. Basically, JS doesn't innately have the ability to do so, unlike Java, etc., but certainly it can be simulated (as we can see with things like the chat services offered by Gmail, Facebook, etc.). As far as I can tell, the only real option is to use the setInterval method with Ajax to constantly poll the server, and check whether the status of whatever has been updated, and if it has, make the necessary changes on the client side. Anyway, I know there's more to it than that, but I'm curious if there are any best practices and/or there's a completely different approach that can be taken to this problem to make things are efficient as possible. Also, I've been reading about web workers recently, and I'm wondering if using those makes asynchronous messaging in JS smoother. Any thoughts or opinions from anyone are welcome. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts