Long Polling fallback with websocket spring initialization

I am using Spring annotations to initialize my BayeuxServer. I enabled websocket by setting the transport in my Spring bean -

 BayeuxServerImpl bean = new BayeuxServerImpl();

 bean.setTransports(new WebSocketTransport(bean));

But now, when websocket connection fails or is disabled in js($.cometd.websocketEnabled = false;), it's not falling back to long polling successfully. It throws error "400 Unknown Bayeux Transport" in firebug console.

I couldn't set LongPollingTransport in setTransports since LongPollingTransport is an abstract class in the library. I tried creating a class which extends LongPollingTransport and specifying it in the setTransports API, but that didn't work either. Please let me know if I am doing something wrong. We need long polling to work in case websockets fail.

cometd version: 2.5.1

jetty version: 7.6.8


By calling BayeuxServer.setTransports(...) with just one transport, you basically disable any fall back capability since you are explicitly telling CometD to use 1 transport only.

Class LongPollingTransport has 2 subclasses depending on the specific mechanism to use; you may want to use class JSONTransport.

Note that the CometD documentation has an example of how to setup WebSocket with Spring using XML, but it is enough to translate the XML into code to have it working with annotations.

Basically, it all boils down to:

bayeuxServer.setTransports(new WebSocketTransport(bayeuxServer), new JSONTransport(bayeuxServer));

Need Your Help

rails 2 limit the loading record with pagination without using pagination gem but active record query

activerecord pagination offset ruby-on-rails-2

I am working on rails 2 application I need to work with the 8000 records and show them in table.

How to check when a powershell script is done running with Visual Studio

vb.net visual-studio powershell

I am running a powershell script from within my app. I can start it and it completes without problem, but how do I check when its done? I need to do other actions, Only once its complete. Here is w...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.