Package com.pusher.client.user
Interface User
-
- All Known Implementing Classes:
InternalUser
public interface User
An object that represents a user on a Pusher connection. An implementation of this interface is returned when you callPusher.user().
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidbind(java.lang.String eventName, SubscriptionEventListener listener)Binds aSubscriptionEventListenerto an event.voidbindGlobal(SubscriptionEventListener listener)Binds aSubscriptionEventListenerto all events.voidunbind(java.lang.String eventName, SubscriptionEventListener listener)Unbinds a previously boundSubscriptionEventListenerfrom an event.voidunbindGlobal(SubscriptionEventListener listener)Unbinds a previously boundSubscriptionEventListenerfrom global events.java.lang.StringuserId()
-
-
-
Method Detail
-
userId
java.lang.String userId()
- Returns:
- The user id of the signed in user. Null if no user is signed in;
-
bind
void bind(java.lang.String eventName, SubscriptionEventListener listener)
Binds aSubscriptionEventListenerto an event. TheSubscriptionEventListenerwill be notified whenever the specified event is received for this user.- Parameters:
eventName- The name of the event to listen to.listener- A listener to receive notifications when the event is received.- Throws:
java.lang.IllegalArgumentException- If either of the following are true:- The name of the event is null.
- The
SubscriptionEventListeneris null.
-
bindGlobal
void bindGlobal(SubscriptionEventListener listener)
Binds aSubscriptionEventListenerto all events. TheSubscriptionEventListenerwill be notified whenever an event is received for this user.- Parameters:
listener- A listener to receive notifications when the event is received.- Throws:
java.lang.IllegalArgumentException- If theSubscriptionEventListeneris null.
-
unbind
void unbind(java.lang.String eventName, SubscriptionEventListener listener)
Unbinds a previously bound
SubscriptionEventListenerfrom an event. TheSubscriptionEventListenerwill no longer be notified whenever the specified event is received for this user.- Parameters:
eventName- The name of the event to stop listening to.listener- The listener to unbind from the event.- Throws:
java.lang.IllegalArgumentException- If either of the following are true:- The name of the event is null.
- The
SubscriptionEventListeneris null.
-
unbindGlobal
void unbindGlobal(SubscriptionEventListener listener)
Unbinds a previously bound
SubscriptionEventListenerfrom global events. TheSubscriptionEventListenerwill no longer be notified whenever the any event is received for this user.- Parameters:
listener- The listener to unbind from the event.- Throws:
java.lang.IllegalArgumentException- If theSubscriptionEventListeneris null.
-
-