org.cometd.bayeux.server
Interface ServerChannel

All Superinterfaces:
Channel, ConfigurableServerChannel

public interface ServerChannel
extends ConfigurableServerChannel

Server side representation of a Bayeux channel.

ServerChannel is the entity that holds a set of ServerSessions that are subscribed to the channel itself.

A message published to a ServerChannel will be delivered to all the ServerSession's subscribed to the channel.

Contrary to their client side counterpart (ClientSessionChannel) a ServerChannel is not scoped with a session.

Version:
$Revision: 1483 $ $Date: 2009-03-04 14:56:47 +0100 (Wed, 04 Mar 2009) $

Nested Class Summary
static interface ServerChannel.MessageListener
          Listeners objects that implement this interface will be notified of message publish.
static interface ServerChannel.ServerChannelListener
          Common interface for ServerChannel listeners.
static interface ServerChannel.SubscriptionListener
          Listeners object that implement this interface will be notified of subscription events.
 
Nested classes/interfaces inherited from interface org.cometd.bayeux.server.ConfigurableServerChannel
ConfigurableServerChannel.Initializer
 
Field Summary
 
Fields inherited from interface org.cometd.bayeux.Channel
META, META_CONNECT, META_DISCONNECT, META_HANDSHAKE, META_SUBSCRIBE, META_UNSUBSCRIBE
 
Method Summary
 Set<ServerSession> getSubscribers()
           
 boolean isBroadcast()
          A broadcasting channel is a channel that is neither a meta channel not a service channel.
 void publish(Session from, Object data, String id)
          Publishes the given information to this channel.
 void publish(Session from, ServerMessage.Mutable message)
          Publishes the given message to this channel, delivering the message to all the ServerSessions subscribed to this channel.
 void remove()
          Removes this channel, and all the children channels.
 
Methods inherited from interface org.cometd.bayeux.server.ConfigurableServerChannel
addAuthorizer, addListener, getAuthorizers, getListeners, isLazy, isPersistent, removeAuthorizer, removeListener, setLazy, setPersistent
 
Methods inherited from interface org.cometd.bayeux.Channel
getAttribute, getAttributeNames, getChannelId, getId, isDeepWild, isMeta, isService, isWild, removeAttribute, setAttribute
 

Method Detail

getSubscribers

Set<ServerSession> getSubscribers()
Returns:
a snapshot of the set of subscribers of this channel

isBroadcast

boolean isBroadcast()
A broadcasting channel is a channel that is neither a meta channel not a service channel.

Returns:
whether the channel is a broadcasting channel

publish

void publish(Session from,
             ServerMessage.Mutable message)

Publishes the given message to this channel, delivering the message to all the ServerSessions subscribed to this channel.

Parameters:
from - the session from which the message originates
message - the message to publish
See Also:
publish(Session, Object, String)

publish

void publish(Session from,
             Object data,
             String id)

Publishes the given information to this channel.

Parameters:
from - the session from which the message originates
data - the data of the message
id - the id of the message
See Also:
#publish(Session, ServerMessage)

remove

void remove()

Removes this channel, and all the children channels.

If channel "/foo", "/foo/bar" and "/foo/blip" exist, removing channel "/foo" will remove also "/foo/bar" and "/foo/blip".

The removal will notify BayeuxServer.ChannelListener listeners.



Copyright © 2008-2010 Dojo Foundation. All Rights Reserved.