I'm implementing a real-time notification system using XMPP over BOSH and Strophe on the client-side, but I'm having some problems. When I log onto my website I establish a BOSH connection in back-end and save JID, SID and RID as cookies. When the page is reloaded I get the data from the cookies and attach to that session using Strophe's attach function. I get a callback status which says I've been attached.
The first problem I'm facing is that requests are being sent every second second or so. These are the request headers:
Request URL:http://localhost:7070/http-bind/
Request Method:POST
Status Code:200 OKRequest Headers
Accept: */*
Accept-Charset:UTF-8,*;q=0.5
Accept-Encoding:gzip,deflate,sdch
Accept-Language:sv-SE,sv;q=0.8,en-US;q=0.6,en;q=0.4
Cache-Control:max-age=0
Connection:keep-alive
Content-Length:77
Cookie:JSESSIONID=ibxwvm3ophp8; jiveforums.admin.logviewer="debug.size=0&info.size=0&warn.size=0&error.size=0"
Host:localhost:7070
Origin:http://***
Referer:http://***/flXHR/flXHR.swf
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.107 Safari/535.1 content-type:application/x-www-form-urlencodedForm Data
< body rid:'3007' xmlnsResponse Headers
Content-Length:57
Content-Type:text/xml;charset=UTF-8
Server:Jetty(7.0.2-SNAPSHOT)
I can't see any response content so I'm not sure what's causing it. The form data being sent looks like invalid and incomplete XML, is this what causes it or is that just how Chrome would format it in the debugger?
The other problem I'm facing is when I reload the page. I've bound an unload event to the window object in which I increase the RID by one and save it to the cookie. However, when the page is reloaded it says that I've attached to the BOSH session but then I get the following error message:
POST http://localhost:7070/http-bind/ 404 (Not Found) (localhost)
Uncaught Error: 16, ioError, An error occured preventing completion of the request. (flensed.js)
The next request will throw 404 (Invalid SID.) instead of 404 (Not Found) and repeats every 70+ seconds or so.
Has anyone else gotten this problem and know how to solve it? I'm frustrated!
Thanks in advance,
Pierre