Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Ajax
|
Ajax the combination of XHTML, CSS, DOM, XML, XSLT, XMLHttpRequest, and JavaScript
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Ajax section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 28th, 2010, 07:23 PM
Registered User
 
Join Date: Dec 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unable to start ajax request when one comet is running

Hi all,

first of all, I did try searching but... deh, couldn't find anything related. If it's a well known issue, call me a noobie, but please set me on the right path :) and thanks.

I'm beginning to bang my head on Ajax and Comet, bought WROX "Professional Ajax 2nd ed" book and started rigging my own chat. So I made some experiments with ajax first, then dropped some comet in, and lo and behold I have a measly chat-page. Lovely. Now onto my problem.

My chat page receives messages just fine, and sends messages just fine as long as I'm doing one or the other thing. Not both.
My analysis (and firebug, god bless firebug) shows that while the comet connection is open, the ajax request stays waiting. As soon as I stop the comet, the ajax post gets served and obtains correct results. I can restart comet then and it'll serve the message I just inserted. I know there's a 2 connection limit (raised to 6 in FF3, apparently), I should hit it but not go beyond it.

Technicalities:
- client.php is the client - has an iframe src=about:blank that I redirect to the server script (actions/chat.php). Normally the comet frame would be reset every minute, but I've commented that part to reduce complexity.
- actions/chat.php is the server script. Does both accepting new messages and sending out received ones.
- I tried moving the post message action to another script, action/chatmsg.php - same behavior.
- I'm sure the comet frame is alive when I send the message: I can see the heartbeats coming and firebug reports it's loading. The POST with the new message OTOH is stuck, no readyState notification. As soon as I stop the comet, without further action I receive the notifications and the correct answer from server about the msgs I sent before.
- I tried connecting to the chat from two different clients (IE and FF) and both have it working fine - well "as expected", I receive messages and heartbeats but can't post.
- I don't have any other connection, ajax request or anything else going on while I'm doing this.
- According to research, FF3 should be able to handle 6 concurrent connections to the same domain. I'm unable to reach 2 :(
- I'm using PHP/mySQL + Ajax/Comet.
- Aside from zXML setting a property that only has a getter, there's no error in the code. PHP doesn't report issues either.

Can anyone enlighten me? I'm seriously confused.

The test page is at http://overlord-test.99k.org/client.php - feel free to go play with it. If you happen on the index just hit "ajax it" to be redirected.
The "[beat]" you'll see are comet heartbeating. The [XHR:#] are onReadyStateChange notification statuses (XHR.readyState).
Works on firefox and IE8 for now, haven't checked any other browser.

Thanks!
Calimar

Last edited by calimar; December 28th, 2010 at 08:04 PM.. Reason: did one more test in the meanwhile.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to start the program gfranco BOOK: Beginning ASP.NET 4 : in C# and VB 2 November 7th, 2010 02:31 PM
running a sub at the start of a database ttitto Access VBA 1 January 22nd, 2010 09:16 AM
How To Start with JAVA/AJAX sathiya Ajax 2 July 2nd, 2009 07:54 AM
Error::Unable to start debugging on th hums ASP.NET 1.x and 2.0 Application Design 2 August 11th, 2004 01:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.