Http-bind and presence

I am testing http-bind and have hit an issue with presence. When there are messages waiting, then the presence returns almost immediately with the messages. However, if there are no messages waiting, then the presence does not return anything from the server, and the http-bind call "wait"s for the specified time (e.g. 60 secs) before timing out and returning -

Would it be possible to special-case the handling of the presence stanza in http-bind so that it returns faster than the “wait” amount when there are no messages on the server?

Why is this an issue that it is waiting for a response from the server?

Thanks,

Alex

My application supports long “wait” times, but when I log in and set presence, I don’'t want to have to wait if there are no messages available - I suppose I could set the presence in one thread and continue on with other work in another, but I really wanted to be single-threaded.

As far as I can see, when using the Java smack api, there is no such delay when setting presence irrespective of whether there are messages available or not - the call returns immediately in both instances. It looks like the http-bind always "wait"s because there is no message returned from the server.

I guess it would be nice for the server to send back something in the case of nothing being available - could I create a plugin that sees the presence message and replies with a dummy message.

Alternatively it would be nice to have a non-blocking presence method in http-bind… or be able to update the wait setting in the http-bind session after login, so that I could have a short wait for the presence message and then long waits afterwards…

I don’‘t think special casing any packets sent to the server is desirable. Its one of the beautiful parts of the implementation, and also made it very simple, that it is agnostic as to what the client is asking for, it passes the packets off to the server and then does its thing. This sounds very specific to your implementation and I don’‘t think would be useful under many other circumstances. The comparison to the Java smack API is not really relevant as it has one static connection to the server whereas HTTP binding is carried out over many connections. If you want to implement your program using a single thread I would recommend setting your hold value to 0 so that the server won’'t hold any connections open at all, then, use a polling mechanism to query for new packets.

Thanks,

Alex