I'm writing jquery client for cometd server (i'm using jquery.cometd.js plugin) and I'm running out of ideas why the simplest possible case doesn't work.
The cometd server is behind apache (so it's running on this same domain) and all the requests are forwarded from uri http://wwwhost/cometd.
The problem is that when I try to connect (by executing handshake()) to the cometd it's not sending requests directly to /cometd but to /cometd/handshake that gives 404 error. I checked on the other apps that I was testing and dojo is always connecting to /cometd and then sending message 'handshake'.
Anyone has an idea why jquery.cometd is doing that?
This is what i can see in the apache logs:
- - [23/Mar/2010:17:59:30 +0100] "POST /cometd/handshake HTTP/1.1" 404 158 "http://wwwhost/" "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100308 Iceweasel/3.5.8 (like Firefox/3.5.8)"
Below you can find the code i'm using (it's more or less what i got from examples).
(function($)
{
var COMETD_URL = "http://wwwhost/cometd";
var cometd = $.cometd;
$(document).ready(function() {
cometd.configure({
url: COMETD_URL,
logLevel: 'debug'
});
cometd.handshake();
});
})(jQuery);
and the firebug debug:
Initial transport is Object {}
cometd.js (line 278)
Status disconnected -> handshaking
cometd.js (line 278)
Handshake sent Object { version="1.0", more...}
cometd.js (line 278)
Send Object { url="http://wwwhost/cometd/handshake", more...}
cometd.js (line 278)
POST http://wwwhost/cometd/handshake
POST http://wwwhost/cometd/handshake
404 Not Found 104ms
EDIT
It looks like my server implementation doesn't support the URI that is other than cometd. Jquery adds at the end the type of the message so when sending handshake it sends it to: /cometd/handshake which in general looks like that /cometd/message_type.
I found function that is sending messages in the cometd.js code and the function have three paramters:
function _send(messages, longpoll, extraPath)
and this function is called for example:
_send([message], true, 'connect');
which means i will always end up with /cometd/handshake. I have to either fix the server or comment out the append url in cometd.js.