I’m using prosody XMPP server and trying out chapter 3 example from “Professional XMPP Programming with JavaScript and jQuery”. It is basically ping – pong example and it works fine. Problem is when I try to modify this example to store jid, sid and rid inside cookie to use this data to call strophie attach() instead of connect() on page reload. My example works great if I’m doing two or more pings one by one, if i’m doing only one server doesn’t return anything. Here’s my code:
The whole Javascript code is here
Problem is when I do $(document).trigger('connected'); twice in on_connect function when status === Strophe.Status.ATTACHEDI get two pings sent and pong handler is trigerred twice. When I trigger ping only once, pong handler doesn’t get called ever.
Thanks in advance.
Your rid number must plus one when you
attach()make this change in your code: