public class ChannelImpl extends Object implements InternalChannel
| Modifier and Type | Field and Description |
|---|---|
protected String |
name |
protected ChannelState |
state |
protected static String |
SUBSCRIPTION_SUCCESS_EVENT |
| Constructor and Description |
|---|
ChannelImpl(String channelName,
Factory factory) |
| Modifier and Type | Method and Description |
|---|---|
void |
bind(String eventName,
SubscriptionEventListener listener)
Binds a
SubscriptionEventListener to an event. |
int |
compareTo(InternalChannel other) |
protected String[] |
getDisallowedNameExpressions() |
ChannelEventListener |
getEventListener() |
String |
getName()
Gets the name of the Pusher channel that this object represents.
|
boolean |
isSubscribed() |
void |
onMessage(String event,
String message) |
void |
setEventListener(ChannelEventListener listener) |
String |
toString() |
String |
toSubscribeMessage() |
String |
toUnsubscribeMessage() |
void |
unbind(String eventName,
SubscriptionEventListener listener)
Unbinds a previously bound
SubscriptionEventListener from an
event. |
void |
updateState(ChannelState state) |
protected static final String SUBSCRIPTION_SUCCESS_EVENT
protected final String name
protected volatile ChannelState state
public String getName()
Channelpublic void bind(String eventName, SubscriptionEventListener listener)
ChannelSubscriptionEventListener to an event. The
SubscriptionEventListener will be notified whenever the specified
event is received on this channel.public void unbind(String eventName, SubscriptionEventListener listener)
Channel
Unbinds a previously bound SubscriptionEventListener from an
event. The SubscriptionEventListener will no longer be notified
whenever the specified event is received on this channel.
Calling this method does not unsubscribe from the channel even if there
are no more SubscriptionEventListeners bound to it. If you want
to unsubscribe from the channel completely, call
Pusher.unsubscribe(String). It is not necessary
to unbind your SubscriptionEventListeners first.
public boolean isSubscribed()
isSubscribed in interface Channelpublic void onMessage(String event, String message)
onMessage in interface InternalChannelpublic String toSubscribeMessage()
toSubscribeMessage in interface InternalChannelpublic String toUnsubscribeMessage()
toUnsubscribeMessage in interface InternalChannelpublic void updateState(ChannelState state)
updateState in interface InternalChannelpublic void setEventListener(ChannelEventListener listener)
setEventListener in interface InternalChannelpublic ChannelEventListener getEventListener()
getEventListener in interface InternalChannelpublic int compareTo(InternalChannel other)
compareTo in interface Comparable<InternalChannel>protected String[] getDisallowedNameExpressions()
Copyright © 2016 Pusher. All rights reserved.