Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery and cometd problems with URL and 404 errors
    primarykey
    data
    text
    <p>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.</p> <p>The cometd server is behind apache (so it's running on this same domain) and all the requests are forwarded from uri <a href="http://wwwhost/cometd" rel="nofollow noreferrer">http://wwwhost/cometd</a>.</p> <p>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'. </p> <p>Anyone has an idea why jquery.cometd is doing that?</p> <p>This is what i can see in the apache logs:</p> <pre><code>- - [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)" </code></pre> <p>Below you can find the code i'm using (it's more or less what i got from examples). </p> <pre><code>(function($) { var COMETD_URL = "http://wwwhost/cometd"; var cometd = $.cometd; $(document).ready(function() { cometd.configure({ url: COMETD_URL, logLevel: 'debug' }); cometd.handshake(); }); })(jQuery); </code></pre> <p>and the firebug debug:</p> <pre><code>Initial transport is Object {} cometd.js (line 278) Status disconnected -&gt; 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 </code></pre> <p><strong>EDIT</strong></p> <p>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. </p> <p>I found function that is sending messages in the cometd.js code and the function have three paramters:</p> <pre><code>function _send(messages, longpoll, extraPath) </code></pre> <p>and this function is called for example: </p> <pre><code> _send([message], true, 'connect'); </code></pre> <p>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. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload