[Catalyst] long poll AJAX

jeff robinson jeffreyianrobinson at gmail.com
Tue Jun 7 17:08:25 GMT 2011

I am using Catalyst to display some server side data using AJAX.
Essentially there are 3 main blocks:
1) The users browser, runing javascript and using the XMLHttpRequest
object for the AJAX calls
2) The Catalyst web server
3) A remote data server (RDS). This is another Perl app (POE based)
that has a simple API using JSON.

Some calls on the RDS API basically perform login (to the data source)
and provide status info. One call in particular uses the long poll
AJAX technique to provide minimal delay when the server side data
changes. A particular URL on Catalyst is basically a relay to the
remote data source. It uses IO::Socket to create the necessary TCP

Here's the problem:

Everything works fine if the data poll is not delayed and the various
AJAX requests are completed in a sequential fashion. However what I'm
looking for is the long poll request to just sit there while other
AJAX requests check status etc. The AJAX requests are made to a single
URL, with an argument that is the request, ie /myserver/ajax/?{JSON
data}  From separate tests I know the data source end works fine in
this regard. I'm using firebug's networking screen to check on the
requests from the browser to Catalyst and that looks good. The problem
seems to be a bottleneck in Catalyst, because as soon as the long poll
completes all of the waiting status requests complete instantly as
well. I had imagined that the threading on Catalyst would support the
functionality I'm looking for. Any ideas how to resolve?
Thanks - Jeff

More information about the Catalyst mailing list