java - Long Polling fallback with websocket spring initialization -
i using spring annotations initialize bayeuxserver. enabled websocket setting transport in spring bean -
bayeuxserverimpl bean = new bayeuxserverimpl(); bean.settransports(new websockettransport(bean));
but now, when websocket connection fails or disabled in js($.cometd.websocketenabled = false;)
, it's not falling long polling successfully. throws error "400 unknown bayeux transport"
in firebug console.
i couldn't set longpollingtransport
in settransports
since longpollingtransport
abstract class in library. tried creating class extends longpollingtransport
, specifying in settransports
api, didn't work either. please let me know if doing wrong. need long polling work in case websockets fail.
cometd version: 2.5.1
jetty version: 7.6.8
by calling bayeuxserver.settransports(...)
1 transport, disable fall capability since explicitly telling cometd use 1 transport only.
class longpollingtransport
has 2 subclasses depending on specific mechanism use; may want use class jsontransport
.
note cometd documentation has example of how setup websocket spring using xml, enough translate xml code have working annotations.
basically, boils down to:
bayeuxserver.settransports(new websockettransport(bayeuxserver), new jsontransport(bayeuxserver));
Comments
Post a Comment