Http-bind polling interval check violates spec

With these changes in place, I feel like I am getting very close to having a functional AS 2.0 XIFF HttpBinding class working. This is excellent as it will allow our users who are behind restrictive firewalls to connect and chat on our site!

I am currently using an HTTP proxy debugger to watch the traffic that goes back and forth between my client and Openfire and everything looks healthy. One connection is always being held open until either a packet is received or the ‘wait’ time expires, at which point my client opens another connection. I am not getting kicked for polling too fast due to the changes above.

I’ll post any other problems I run into in this thread.

One thing I forgot to mention, a change is required in HttpSession.java (line 767) to prevent some null pointer exceptions:

public Deliverable(String text) {
  this.text = text;
  this.packets = new ArrayList<String>(); // <-- This used to be set to null, which caused NullPointerExceptions during enumeration in some cases
}

And another NullPointerException in HttpSession.java (line 701). This needed a if(packets != null) surrounding it due to the collection sometimes being null.

private void failDelivery(Collection<Packet> packets) {
        if( packets != null ) {
            for (Packet packet : packets) {
                try {
                    backupDeliverer.deliver(packet);
                }
                catch (UnauthorizedException e) {
                    Log.error("Unable to deliver message to backup deliverer", e);
                }
            }
        }
    }

Hi BenV:

Thanks for your changes. I read your post the other day, but didn’t understand that you changes were what was required to fix my problem, until last night when I convinced myself that I wasn’t actually going past the requests element in the response to my session being initiated. Then this afternoon I had a little trace in eclipse that convinced me that this was the right thing to do. I put in your null pointer fixes too, although I haven’t yet experienced any null pointer exceptions.

I found that I could test my javascript code using rhino and John Resig’s env.js. I have attached the fixes that I made to env.js as well as crypt.js from jsjac and my own javascript code for my HttpClientConnection.js and a test script BOSH.js that does the Romeo and Juliet scene from the specifications. Hopefully this is as helpful to someone else as your fixes were to me.

thanks

Rich
env.js (17397 Bytes)
crypt.js (22358 Bytes)
HttpClientConnection.js (8419 Bytes)
BOSH.js (1511 Bytes)

I’m glad these changes helped you out. Any word on if they ever made it into the official tree?

bump