## dojox.cometd
Interface Bayeux

All Known Implementing Classes:
  AbstractBayeux, ContinuationBayeux

    public interface Bayeux

Bayeux Interface. This interface represents the server side API for the Bayeux messaging protocol.

The implementation of Bayeux will be registered as a `ServletContext` attribute with the name "dojox.cometd.bayeux". This may be set prior to the context being initialized (if the instance is shared between contexts) or during context initialization.

Bayeux implementations must be thread safe and multiple threads may simultaneously call Bayeux methods.

Field Summary
`static String` `ADVICE_FIELD` Field names inside Bayeux messages - advice field
`static String` `CHANNEL_FIELD` Field names inside Bayeux messages - channel field
`static String` `CLIENT_FIELD` Field names inside Bayeux messages - clientId field
`static String` `CONNECTION_TYPE_FIELD` Field names inside Bayeux messages - connectionType field
`static String` `DATA_FIELD` Field names inside Bayeux messages - data field
`static String` `DOJOX_COMETD_BAYEUX` ServletContext attribute name used to obtain the Bayeux object
`static String` `ERROR_FIELD` Field names inside Bayeux messages - error field
`static String` `EXT_FIELD` Field names inside Bayeux messages - ext field
`static String` `HANDSHAKE_RESPONSE` Field values inside Bayeux messages - handshake response
`static String` `ID_FIELD` Field names inside Bayeux messages - id field
`static String` `INTERVAL_FIELD` Field names inside Bayeux messages - interval field
`static String` `JSON_COMMENT_FILTERED_FIELD` Field names inside Bayeux messages - json-comment-filtered field
`static String` `JSON_CONTENT_TYPE` http helpers - text/json content type
`static String` `JSONP_DEFAULT_NAME` http helpers - default name of the jsonp callback function
`static String` `JSONP_PARAMETER` http helpers - name of the jsonp parameter
`static String` `MESSAGE_PARAMETER` http helpers - parameter name for json message
`static String` `META` Meta definitions for channels
`static String` `META_CLIENT` Meta definitions for channels - client messsage
`static String` `META_CONNECT` Meta definitions for channels - connect message
`static String` `META_DISCONNECT` Meta definitions for channels - disconnect messsage
`static String` `META_HANDSHAKE` Meta definitions for channels - handshake messsage
`static String` `META_PING` Meta definitions for channels - ping messsage
`static String` `META_SLASH` Meta definitions for channels
`static String` `META_STATUS` Meta definitions for channels - status messsage
`static String` `META_SUBSCRIBE` Meta definitions for channels - subscribe messsage
`static String` `META_UNSUBSCRIBE` Meta definitions for channels - unsubscribe messsage
`static String` `MIN_VERSION_FIELD` Field names inside Bayeux messages - minimumVersion field
`static String` `NONE_RESPONSE` Field values inside Bayeux messages - none response
`static String` `RECONNECT_FIELD` Field names inside Bayeux messages - reconnect field
`static String` `RETRY_RESPONSE` Field values inside Bayeux messages - retry response
`static String` `SERVICE` Service channel names-starts with
`static String` `SERVICE_SLASH` Service channel names-trailing slash
`static String` `SUBSCRIPTION_FIELD` Field names inside Bayeux messages - subscription field
`static String` `SUCCESSFUL_FIELD` Field names inside Bayeux messages - successful field
`static String` `SUPP_CONNECTION_TYPE_FIELD` Field names inside Bayeux messages - supportedConnectionTypes field
`static String` `TIMESTAMP_FIELD` Field names inside Bayeux messages - timestamp field
`static String` `TRANSPORT_CALLBACK_POLL` Transport types - callback polling
`static String` `TRANSPORT_FIELD` Field names inside Bayeux messages - transport field
`static String` `TRANSPORT_FLASH` Transport types - flash
`static String` `TRANSPORT_IFRAME` Transport types - iframe
`static String` `TRANSPORT_LONG_POLL` Transport types - long polling
`static String` `VERSION_FIELD` Field names inside Bayeux messages - version field

Method Summary
`void` `addFilter(String channels, DataFilter filter)` Deprecated. user `Channel.addDataFilter(DataFilter)`
`void` `deliver(Client fromClient, Client toClient, String toChannel, Message message)` Deprecated. use `Client.deliver(Client, Message)`
`Channel` `getChannel(String channelId, boolean create)` Get a Channel instance by ID.
`Collection<Channel>` `getChannels()` Get all known channels.
`Client` `getClient(String clientId)`
`Collection<Client>` `getClients()`
`SecurityPolicy` `getSecurityPolicy()`
`boolean` `hasChannel(String channel)`
`boolean` `hasClient(String clientId)`
`Client` `newClient(String idprefix)`
`Client` `newClient(String idprefix, Listener listener)` Deprecated. use `newClient(String)`
`void` `publish(Client fromClient, String toChannel, Object data, String msgId)` Deprecated. use `Channel.publish(Client, Object, String)`
`Channel` `removeChannel(String channel)`
`Client` `removeClient(String clientId)`
`void` `removeFilter(String channels, DataFilter filter)` Deprecated. user `Channel.removeDataFilter(DataFilter)`
`void` `setSecurityPolicy(SecurityPolicy securityPolicy)` Set the security policy for the Bayeux instance.
`void` `subscribe(String toChannel, Client subscriber)` Deprecated. use `Channel.subscribe(Client)`
`void` `unsubscribe(String toChannel, Client subscriber)` Deprecated. use `Channel.unsubscribe(Client)`

Field Detail

### META

    static final String META

  Meta definitions for channels

  See Also:
    Constant Field Values

### META_SLASH

    static final String META_SLASH

  Meta definitions for channels

  See Also:
    Constant Field Values

### META_CONNECT

    static final String META_CONNECT

  Meta definitions for channels - connect message

  See Also:
    Constant Field Values

### META_CLIENT

    static final String META_CLIENT

  Meta definitions for channels - client messsage

  See Also:
    Constant Field Values

### META_DISCONNECT

    static final String META_DISCONNECT

  Meta definitions for channels - disconnect messsage

  See Also:
    Constant Field Values

### META_HANDSHAKE

    static final String META_HANDSHAKE

  Meta definitions for channels - handshake messsage

  See Also:
    Constant Field Values

### META_PING

    static final String META_PING

  Meta definitions for channels - ping messsage

  See Also:
    Constant Field Values

### META_STATUS

    static final String META_STATUS

  Meta definitions for channels - status messsage

  See Also:
    Constant Field Values

### META_SUBSCRIBE

    static final String META_SUBSCRIBE

  Meta definitions for channels - subscribe messsage

  See Also:
    Constant Field Values

### META_UNSUBSCRIBE

    static final String META_UNSUBSCRIBE

  Meta definitions for channels - unsubscribe messsage

  See Also:
    Constant Field Values

### CLIENT_FIELD

    static final String CLIENT_FIELD

  Field names inside Bayeux messages - clientId field

  See Also:
    Constant Field Values

### DATA_FIELD

    static final String DATA_FIELD

  Field names inside Bayeux messages - data field

  See Also:
    Constant Field Values

### CHANNEL_FIELD

    static final String CHANNEL_FIELD

  Field names inside Bayeux messages - channel field

  See Also:
    Constant Field Values

### ID_FIELD

    static final String ID_FIELD

  Field names inside Bayeux messages - id field

  See Also:
    Constant Field Values

### ERROR_FIELD

    static final String ERROR_FIELD

  Field names inside Bayeux messages - error field

  See Also:
    Constant Field Values

### TIMESTAMP_FIELD

    static final String TIMESTAMP_FIELD

  Field names inside Bayeux messages - timestamp field

  See Also:
    Constant Field Values

### TRANSPORT_FIELD

    static final String TRANSPORT_FIELD

  Field names inside Bayeux messages - transport field

  See Also:
    Constant Field Values

### ADVICE_FIELD

    static final String ADVICE_FIELD

  Field names inside Bayeux messages - advice field

  See Also:
    Constant Field Values

### SUCCESSFUL_FIELD

    static final String SUCCESSFUL_FIELD

  Field names inside Bayeux messages - successful field

  See Also:
    Constant Field Values

### SUBSCRIPTION_FIELD

    static final String SUBSCRIPTION_FIELD

  Field names inside Bayeux messages - subscription field

  See Also:
    Constant Field Values

### EXT_FIELD

    static final String EXT_FIELD

  Field names inside Bayeux messages - ext field

  See Also:
    Constant Field Values

### CONNECTION_TYPE_FIELD

    static final String CONNECTION_TYPE_FIELD

  Field names inside Bayeux messages - connectionType field

  See Also:
    Constant Field Values

### VERSION_FIELD

    static final String VERSION_FIELD

  Field names inside Bayeux messages - version field

  See Also:
    Constant Field Values

### MIN_VERSION_FIELD

    static final String MIN_VERSION_FIELD

  Field names inside Bayeux messages - minimumVersion field

  See Also:
    Constant Field Values

### SUPP_CONNECTION_TYPE_FIELD

    static final String SUPP_CONNECTION_TYPE_FIELD

  Field names inside Bayeux messages - supportedConnectionTypes field

  See Also:
    Constant Field Values

### JSON_COMMENT_FILTERED_FIELD

    static final String JSON_COMMENT_FILTERED_FIELD

  Field names inside Bayeux messages - json-comment-filtered field

  See Also:
    Constant Field Values

### RECONNECT_FIELD

    static final String RECONNECT_FIELD

  Field names inside Bayeux messages - reconnect field

  See Also:
    Constant Field Values

### INTERVAL_FIELD

    static final String INTERVAL_FIELD

  Field names inside Bayeux messages - interval field

  See Also:
    Constant Field Values

### RETRY_RESPONSE

    static final String RETRY_RESPONSE

  Field values inside Bayeux messages - retry response

  See Also:
    Constant Field Values

### HANDSHAKE_RESPONSE

    static final String HANDSHAKE_RESPONSE

  Field values inside Bayeux messages - handshake response

  See Also:
    Constant Field Values

### NONE_RESPONSE

    static final String NONE_RESPONSE

  Field values inside Bayeux messages - none response

  See Also:
    Constant Field Values

### SERVICE

    static final String SERVICE

  Service channel names-starts with

  See Also:
    Constant Field Values

### SERVICE_SLASH

    static final String SERVICE_SLASH

  Service channel names-trailing slash

  See Also:
    Constant Field Values

### TRANSPORT_LONG_POLL

    static final String TRANSPORT_LONG_POLL

  Transport types - long polling

  See Also:
    Constant Field Values

### TRANSPORT_CALLBACK_POLL

    static final String TRANSPORT_CALLBACK_POLL

  Transport types - callback polling

  See Also:
    Constant Field Values

### TRANSPORT_IFRAME

    static final String TRANSPORT_IFRAME

  Transport types - iframe

  See Also:
    Constant Field Values

### TRANSPORT_FLASH

    static final String TRANSPORT_FLASH

  Transport types - flash

  See Also:
    Constant Field Values

### DOJOX_COMETD_BAYEUX

    static final String DOJOX_COMETD_BAYEUX

  ServletContext attribute name used to obtain the Bayeux object

  See Also:
    Constant Field Values

### JSON_CONTENT_TYPE

    static final String JSON_CONTENT_TYPE

  http helpers - text/json content type

  See Also:
    Constant Field Values

### MESSAGE_PARAMETER

    static final String MESSAGE_PARAMETER

  http helpers - parameter name for json message

  See Also:
    Constant Field Values

### JSONP_PARAMETER

    static final String JSONP_PARAMETER

  http helpers - name of the jsonp parameter

  See Also:
    Constant Field Values

### JSONP_DEFAULT_NAME

    static final String JSONP_DEFAULT_NAME

  http helpers - default name of the jsonp callback function

  See Also:
    Constant Field Values

Method Detail

### addFilter

    void addFilter(String channels,
                   DataFilter filter)

  Deprecated. user `Channel.addDataFilter(DataFilter)`

### deliver

    void deliver(Client fromClient,
                 Client toClient,
                 String toChannel,
                 Message message)

  Deprecated. use `Client.deliver(Client, Message)`

  Deliver a message to a client.

### getChannel

    Channel getChannel(String channelId,
                       boolean create)

  Get a Channel instance by ID.

  Parameters:
    `channelId` - The Channel ID
    `create` - If true, a channel will be created if it does not exist.
  Returns:
    A Channel instance or null if it does not exist and create is false.

### getChannels

    Collection<Channel> getChannels()

  Get all known channels.

  Returns:
    A collection of all known channel instances.

### getClient

    Client getClient(String clientId)

### getClients

    Collection<Client> getClients()

### getSecurityPolicy

    SecurityPolicy getSecurityPolicy()

### hasChannel

    boolean hasChannel(String channel)

### hasClient

    boolean hasClient(String clientId)

### newClient

    Client newClient(String idprefix,
                     Listener listener)

  Deprecated. use `newClient(String)`

### newClient

    Client newClient(String idprefix)

### publish

    void publish(Client fromClient,
                 String toChannel,
                 Object data,
                 String msgId)

  Deprecated. use `Channel.publish(Client, Object, String)`

  Deliver data to a channel.

  Parameters:
    `fromClient` - The client sending the data
    `data` - The data itself which must be an Object that can be encoded with `JSON`.
    `toChannel` - The Channel ID to which the data is targetted
    `msgId` - optional message ID or null for automatic generation of a message ID.

### removeChannel

    Channel removeChannel(String channel)

### removeClient

    Client removeClient(String clientId)

### removeFilter

    void removeFilter(String channels,
                      DataFilter filter)

  Deprecated. user `Channel.removeDataFilter(DataFilter)`

### setSecurityPolicy

    void setSecurityPolicy(SecurityPolicy securityPolicy)

  Set the security policy for the Bayeux instance.

  The Security Policy will be called to check access for all handshakes, subscriptions and publishing.

  Parameters:
    `securityPolicy` - The security policy instance.

### subscribe

    void subscribe(String toChannel,
                   Client subscriber)

  Deprecated. use `Channel.subscribe(Client)`

  Subscribe to a channel. Equivalent to getChannel(toChannel).subscribe(subscriber).

  Parameters:
    `toChannel` -
    `subscriber` -
    `createChannel.` - Create the channel if it does not exist

### unsubscribe

    void unsubscribe(String toChannel,
                     Client subscriber)

  Deprecated. use `Channel.unsubscribe(Client)`

  Unsubscribe to a channel

  Parameters:
    `toChannel` -
    `subscriber` -

Copyright © 2008 Mort Bay Consulting. All Rights Reserved.