## org.mortbay.cometd.client
Class BayeuxClient

    java.lang.Object
      org.mortbay.cometd.MessagePool
          org.mortbay.cometd.client.BayeuxClient

All Implemented Interfaces:
  org.cometd.Client

    public class BayeuxClient

extends MessagePool
implements org.cometd.Client

Bayeux protocol Client.

Implements a Bayeux Ajax Push client as part of the cometd project.

Author:
  gregw
See Also:
  `http://cometd.com`

Constructor Summary
`BayeuxClient(HttpClient client, Address address, String uri)`
`BayeuxClient(HttpClient client, Address address, String uri, Timer timer)`

Method Summary
`void` `addListener(org.cometd.ClientListener listener)`
`protected void` `customize(HttpExchange exchange)` Customize an Exchange.
`void` `deliver(org.cometd.Client from, org.cometd.Message message)` Deprecated. use `deliver(Client, String, Object, String)`
`void` `deliver(org.cometd.Client from, String toChannel, Object data, String id)`
`void` `endBatch()`
`String` `getId()`
`org.cometd.Listener` `getListener()` Deprecated.
`int` `getMaxQueue()`
`Queue<org.cometd.Message>` `getQueue()`
`boolean` `hasMessages()`
`boolean` `isLocal()`
`boolean` `isPolling()`
`void` `publish(String toChannel, Object data, String msgId)`
`void` `remove(boolean timeout)`
`void` `removeListener(org.cometd.ClientListener listener)`
`void` `setCookie(Cookie cookie)`
`void` `setListener(org.cometd.Listener listener)` Deprecated.
`void` `setMaxQueue(int max)`
`void` `start()`
`void` `startBatch()`
`void` `subscribe(String toChannel)`
`List<org.cometd.Message>` `takeMessages()`
`void` `unsubscribe(String toChannel)`

Methods inherited from class org.mortbay.cometd.MessagePool
`getBatchJSON, getJSON, getMsgJSON, newMessage, newMessage, parse, parse, parseTo, recycleMessage, setBatchJSON, setJSON, setMsgJSON`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BayeuxClient

    public BayeuxClient(HttpClient client,
                        Address address,
                        String uri,
                        Timer timer)
                 throws IOException

Throws:
  `IOException`

### BayeuxClient

    public BayeuxClient(HttpClient client,
                        Address address,
                        String uri)
                 throws IOException

Throws:
  `IOException`

Method Detail

### getId

    public String getId()

  Specified by:
    `getId` in interface `org.cometd.Client`

### start

    public void start()

### isPolling

    public boolean isPolling()

### deliver

    public void deliver(org.cometd.Client from,
                        org.cometd.Message message)

  Deprecated. use `deliver(Client, String, Object, String)`

  (non-Javadoc)

  See Also:
    `org.cometd.Client#deliver(org.cometd.Client, java.util.Map)`

### deliver

    public void deliver(org.cometd.Client from,
                        String toChannel,
                        Object data,
                        String id)

  Specified by:
    `deliver` in interface `org.cometd.Client`

### getListener

    public org.cometd.Listener getListener()

  Deprecated.

### hasMessages

    public boolean hasMessages()

  Specified by:
    `hasMessages` in interface `org.cometd.Client`

### isLocal

    public boolean isLocal()

  Specified by:
    `isLocal` in interface `org.cometd.Client`

### publish

    public void publish(String toChannel,
                        Object data,
                        String msgId)

### subscribe

    public void subscribe(String toChannel)

### unsubscribe

    public void unsubscribe(String toChannel)

### remove

    public void remove(boolean timeout)

### setListener

    public void setListener(org.cometd.Listener listener)

  Deprecated.

### takeMessages

    public List<org.cometd.Message> takeMessages()

  Specified by:
    `takeMessages` in interface `org.cometd.Client`

### endBatch

    public void endBatch()

  Specified by:
    `endBatch` in interface `org.cometd.Client`

### startBatch

    public void startBatch()

  Specified by:
    `startBatch` in interface `org.cometd.Client`

### customize

    protected void customize(HttpExchange exchange)

  Customize an Exchange. Called when an exchange is about to be sent to allow Cookies and Credentials to be customized. Default implementation sets any cookies

### setCookie

    public void setCookie(Cookie cookie)

### addListener

    public void addListener(org.cometd.ClientListener listener)

  Specified by:
    `addListener` in interface `org.cometd.Client`

### removeListener

    public void removeListener(org.cometd.ClientListener listener)

  Specified by:
    `removeListener` in interface `org.cometd.Client`

### getMaxQueue

    public int getMaxQueue()

  Specified by:
    `getMaxQueue` in interface `org.cometd.Client`

### getQueue

    public Queue<org.cometd.Message> getQueue()

  Specified by:
    `getQueue` in interface `org.cometd.Client`

### setMaxQueue

    public void setMaxQueue(int max)

  Specified by:
    `setMaxQueue` in interface `org.cometd.Client`

Copyright © 1995-2008 Mort Bay Consulting. All Rights Reserved.