public class PresenceManager extends Object
| Constructor and Description |
|---|
PresenceManager(Component component,
UserInfo localUser,
String topicId)
Creates a new manager for the provided component.
|
PresenceManager(ConnectionContext context,
UserInfo localUser,
String topicId,
CollaborationEngine collaborationEngine)
Creates a new manager for the provided connection context.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Disconnects from the topic.
|
String |
getTopicId()
Gets the topic id.
|
void |
markAsPresent(boolean markAsPresent)
Configures the manager to mark the local user present in the topic.
|
void |
setNewUserHandler(NewUserHandler handler)
Deprecated.
Use
setPresenceHandler(PresenceHandler) instead |
void |
setPresenceHandler(PresenceHandler handler)
Sets a handler which will be invoked when a user becomes present.
|
public PresenceManager(Component component, UserInfo localUser, String topicId)
The provided user information is used to set the presence of the local
user with markAsPresent(boolean) (the default is false).
component - the component which holds UI access, not nulllocalUser - the information of the local user, not nulltopicId - the id of the topic to connect to, not nullpublic PresenceManager(ConnectionContext context, UserInfo localUser, String topicId, CollaborationEngine collaborationEngine)
The provided user information is used to set the presence of the local
user with markAsPresent(boolean) (the default is false).
context - the context that manages connection status, not nulllocalUser - the information of the local user, not nulltopicId - the id of the topic to connect to, not nullcollaborationEngine - the collaboration engine instance to use, not nullpublic String getTopicId()
public void close()
public void markAsPresent(boolean markAsPresent)
If the user wasn't already present in the topic, all managers connected to the same topic will be notified of the change and their handlers will be applied to the user instance.
markAsPresent - true to mark the user as present in the topic,
false to set as not present@Deprecated public void setNewUserHandler(NewUserHandler handler)
setPresenceHandler(PresenceHandler) instead
The handler accepts a UserInfo instance as a parameter and should
return a Registration which will be removed when the user stops
being present.
Replacing an existing handler will remove all registrations from the previous one.
handler - the user presence handler, or null to remove an
existing handlerpublic void setPresenceHandler(PresenceHandler handler)
The handler accepts a PresenceHandler.PresenceContext instance as a parameter and
should return a Registration which will be removed when the user
stops being present.
Replacing an existing handler will remove all registrations from the previous one.
handler - the user presence handler, or null to remove an
existing handlerCopyright © 2023. All rights reserved.