[Catalyst] long poll AJAX

Mesdaq, Ali amesdaq at websense.com
Tue Jun 7 18:59:32 GMT 2011

Are you sure it's a Catalyst issue? Sounds like it could be a JS issue with your script waiting for responses before moving on to the rest of the ajax calls. Are you using any JS frameworks? A good test could be you create a stub method in catalyst with different wait periods and verify that your JS code is treating them async. I have implemented something that is almost exactly the same (ajax js, catalyst, poe server that uses json interface over tcp) and it worked as expected so I am pretty sure it's not an catalyst issue.

Sr. Security Researcher

ph: +1.858.320.9466
fax: +1.858.784.4466

Websense TRITON(tm)
For Essential Information Protection(tm)
Web Security | Data Security | Email Security

-----Original Message-----
From: jeff robinson [mailto:jeffreyianrobinson at gmail.com] 
Sent: Tuesday, June 07, 2011 10:08 AM
To: The elegant MVC web framework
Subject: [Catalyst] long poll AJAX

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 connection.

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

List: Catalyst at lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

 To report this as spam, please forward to spam at websense.com.  Thank you.

 Protected by Websense Hosted Email Security -- www.websense.com 

More information about the Catalyst mailing list