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()
Channel
public void bind(String eventName, SubscriptionEventListener listener)
Channel
SubscriptionEventListener
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 SubscriptionEventListener
s bound to it. If you want
to unsubscribe from the channel completely, call
Pusher.unsubscribe(String)
. It is not necessary
to unbind your SubscriptionEventListener
s first.
public boolean isSubscribed()
isSubscribed
in interface Channel
public void onMessage(String event, String message)
onMessage
in interface InternalChannel
public String toSubscribeMessage()
toSubscribeMessage
in interface InternalChannel
public String toUnsubscribeMessage()
toUnsubscribeMessage
in interface InternalChannel
public void updateState(ChannelState state)
updateState
in interface InternalChannel
public void setEventListener(ChannelEventListener listener)
setEventListener
in interface InternalChannel
public ChannelEventListener getEventListener()
getEventListener
in interface InternalChannel
public int compareTo(InternalChannel other)
compareTo
in interface Comparable<InternalChannel>
protected String[] getDisallowedNameExpressions()
Copyright © 2016 Pusher. All rights reserved.