com.pusher.client.channel.impl
Class ChannelImpl
java.lang.Object
com.pusher.client.channel.impl.ChannelImpl
- All Implemented Interfaces:
- Channel, InternalChannel, Comparable<InternalChannel>
- Direct Known Subclasses:
- PrivateChannelImpl
public class ChannelImpl
- extends Object
- implements InternalChannel
SUBSCRIPTION_SUCCESS_EVENT
protected static final String SUBSCRIPTION_SUCCESS_EVENT
- See Also:
- Constant Field Values
name
protected final String name
eventNameToListenerMap
protected final Map<String,Set<SubscriptionEventListener>> eventNameToListenerMap
state
protected ChannelState state
ChannelImpl
public ChannelImpl(String channelName)
getName
public String getName()
- Description copied from interface:
Channel
- Gets the name of the Pusher channel that this object represents.
- Specified by:
getName
in interface Channel
- Returns:
- The name of the channel.
bind
public void bind(String eventName,
SubscriptionEventListener listener)
- Description copied from interface:
Channel
- Binds a
SubscriptionEventListener
to an event. The SubscriptionEventListener
will be notified whenever the
specified event is received on this channel.
- Specified by:
bind
in interface Channel
- Parameters:
eventName
- The name of the event to listen to.listener
- A listener to receive notifications when the event is received.
unbind
public void unbind(String eventName,
SubscriptionEventListener listener)
- Description copied from interface:
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.
- Specified by:
unbind
in interface Channel
- Parameters:
eventName
- The name of the event to stop listening to.listener
- The listener to unbind from the event.
onMessage
public void onMessage(String event,
String message)
- Specified by:
onMessage
in interface InternalChannel
toSubscribeMessage
public String toSubscribeMessage()
- Specified by:
toSubscribeMessage
in interface InternalChannel
toUnsubscribeMessage
public String toUnsubscribeMessage()
- Specified by:
toUnsubscribeMessage
in interface InternalChannel
updateState
public void updateState(ChannelState state)
- Specified by:
updateState
in interface InternalChannel
setEventListener
public void setEventListener(ChannelEventListener listener)
- Specified by:
setEventListener
in interface InternalChannel
getEventListener
public ChannelEventListener getEventListener()
- Specified by:
getEventListener
in interface InternalChannel
compareTo
public int compareTo(InternalChannel other)
- Specified by:
compareTo
in interface Comparable<InternalChannel>
toString
public String toString()
- Overrides:
toString
in class Object
getDisallowedNameExpressions
protected String[] getDisallowedNameExpressions()
Copyright © 2013 Pusher. All Rights Reserved.