uncaught exception: Illegal state: already disconnected

690 views
Skip to first unread message

perissf

unread,
Nov 2, 2012, 2:31:06 PM11/2/12
to cometd...@googlegroups.com
Hi there
Using CometD 2.4.3 in a JSF web application with jQuery on the client side, I have the exception mentioned in the title when invoking this JS code:
$.cometd.subscribe('/price', function(message) { alert(message)});
 
The JS code is fired from the server through JSF servlet, after the page is loaded and running.
 
The JS code that is already loaded in the web page looks like this (inspired from the primer):
 
(function($)
{
    var cometd = $.cometd;
    $(document).ready(function()
    {
        ....
        // Disconnect when the page unloads
        $(window).unload(function()
        {
            cometd.disconnect(true);
        });
        cometd.configure({
            url: contextPath + "cometd",
            logLevel: "debug"
        });
        cometd.addListener('/meta/handshake', _metaHandshake);
        cometd.addListener('/meta/connect', _metaConnect);
    });
})(jQuery);
       
No other relevant JS messages are given.
I am quite new to jQuery / JS, so I am not sure if this information is not enough. In case, please let me know.
 
 

perissf

unread,
Nov 2, 2012, 4:43:29 PM11/2/12
to cometd...@googlegroups.com
A quick update: the same error appears when the subscribe command is launched from a client side event, so the JSF stack appears to be irrelevant to the problem.

Simone Bordet

unread,
Nov 2, 2012, 5:20:30 PM11/2/12
to cometd...@googlegroups.com
Hi,
So where is the handshake() ?

Simon
--
http://cometd.org
http://webtide.com
Developer advice, training, services and support
from the Jetty & CometD experts.
----
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless. Victoria Livschitz
Message has been deleted
Message has been deleted

perissf

unread,
Nov 3, 2012, 7:05:19 AM11/3/12
to cometd...@googlegroups.com
Hi Simon,
thanks for the answer. The handshake was effectively already there, but for some reasons it was not invoked. After a bit of debugging I have fixed it.
Reply all
Reply to author
Forward
0 new messages