Channel
, ConfigurableServerChannel
public interface ServerChannel extends ConfigurableServerChannel
Server side representation of a Bayeux channel.
ServerChannel
is the entity that holds a set of
ServerSession
s 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.
Modifier and Type | Interface | Description |
---|---|---|
static interface |
ServerChannel.MessageListener |
Listeners objects that implement this interface will be notified of message publish.
|
static interface |
ServerChannel.SubscriptionListener |
Listener objects that implement this interface will be notified of subscription events.
|
ConfigurableServerChannel.Initializer, ConfigurableServerChannel.ServerChannelListener
META, META_CONNECT, META_DISCONNECT, META_HANDSHAKE, META_SUBSCRIBE, META_UNSUBSCRIBE, SERVICE
Modifier and Type | Method | Description |
---|---|---|
Set<ServerSession> |
getSubscribers() |
|
default void |
publish(Session from,
Object data) |
Deprecated.
use
publish(Session, Object, Promise) instead |
void |
publish(Session from,
Object data,
Promise<Boolean> promise) |
Publishes the given information to this channel.
|
default void |
publish(Session from,
ServerMessage.Mutable message) |
Deprecated.
use
publish(Session, ServerMessage.Mutable, Promise) instead |
void |
publish(Session from,
ServerMessage.Mutable message,
Promise<Boolean> promise) |
Publishes the given message to this channel, delivering
the message to all the
ServerSession s subscribed to
this channel. |
void |
remove() |
Removes this channel, and all the children channels.
|
boolean |
subscribe(ServerSession session) |
Subscribes the given session to this channel.
|
boolean |
unsubscribe(ServerSession session) |
Unsubscribes the given session from this channel.
|
getAttribute, getAttributeNames, getChannelId, getId, isBroadcast, isDeepWild, isMeta, isService, isWild, removeAttribute, setAttribute
addAuthorizer, addListener, getAuthorizers, getLazyTimeout, getListeners, isLazy, isPersistent, removeAuthorizer, removeListener, setLazy, setLazyTimeout, setPersistent
Set<ServerSession> getSubscribers()
boolean subscribe(ServerSession session)
Subscribes the given session to this channel.
Subscriptions are effective for broadcast channels
and are successful no-operations for service channels
.
The subscription may fail if the session is already subscribed to the channel or if the session is expired or if the channel is a meta channel.
session
- the session to subscribeunsubscribe(ServerSession)
boolean unsubscribe(ServerSession session)
Unsubscribes the given session from this channel.
Unsubscriptions are effective for broadcast channels
and are successful no-operations for service channels
.
The unsubscription may fail if the session is already unsubscribed from the channel or if the session is expired or if the channel is a meta channel.
session
- the session to unsubscribevoid publish(Session from, ServerMessage.Mutable message, Promise<Boolean> promise)
Publishes the given message to this channel, delivering
the message to all the ServerSession
s subscribed to
this channel.
from
- the session from which the message originatesmessage
- the message to publishpublish(Session, Object, Promise)
@Deprecated default void publish(Session from, ServerMessage.Mutable message)
publish(Session, ServerMessage.Mutable, Promise)
insteadvoid publish(Session from, Object data, Promise<Boolean> promise)
Publishes the given information to this channel.
from
- the session from which the message originatesdata
- the data of the messagepublish(Session, ServerMessage.Mutable, Promise)
@Deprecated default void publish(Session from, Object data)
publish(Session, Object, Promise)
insteadvoid 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–2017 The CometD Project. All rights reserved.