Functiondojox.cometd.init

dojo.require("dojox.cometd._base");
defined in dojox/cometd/_base.js

Initialize the cometd implementation of the Bayeux protocol by sending a handshake message. The cometd state will be changed to CONNECTING until a handshake response is received and the first successful connect message has returned. The protocol state changes may be monitored by subscribing to the dojo topic "/cometd/meta" where events are published in the form {cometd:this,action:"handshake",successful:true,state:this.state()}

Usage

function (/*String*/ root, /*Object?*/ props, /*Object?*/ bargs) (view source)
parametertypedescription
rootStringThe URL of the cometd server. If the root is absolute, the host is examined to determine if xd transport is needed. Otherwise the same domain is assumed.
propsObjectOptional. An optional object that is used as the basis of the handshake message
bargsObjectOptional. An optional object of bind args mixed in with the send of the handshake

Examples

Example 1

dojox.cometd.init("/cometd");
dojox.cometd.init("http://xdHost/cometd",{ext:{user:"fred",pwd:"secret"}});