public class RespokeClient extends java.lang.Object implements RespokeSignalingChannel.Listener
| Modifier and Type | Class and Description |
|---|---|
static interface |
RespokeClient.ConnectCompletionListener
A listener interface to receive a notification that the connect action has failed
|
static interface |
RespokeClient.GroupHistoriesCompletionListener
A listener interface to receive a notification when the request to retrieve the history
of messages for a list of groups has completed
|
static interface |
RespokeClient.GroupHistoryCompletionListener
A listener interface to receive a notification when the request to retrieve the
history of messages for a specific group has completed
|
static interface |
RespokeClient.JoinGroupCompletionListener
A listener interface to receive a notification that the task to join the groups has completed
|
static interface |
RespokeClient.Listener
A listener interface to notify the receiver of events occurring with the client
|
static interface |
RespokeClient.ResolvePresenceListener
A listener interface to ask the receiver to resolve a list of presence values for an endpoint
|
| Modifier and Type | Field and Description |
|---|---|
java.lang.String |
baseURL |
static java.lang.String |
PROPERTY_LAST_VALID_PUSH_TOKEN |
static java.lang.String |
PROPERTY_LAST_VALID_PUSH_TOKEN_ID |
| Constructor and Description |
|---|
RespokeClient()
The constructor for this class
|
| Modifier and Type | Method and Description |
|---|---|
void |
callCreated(RespokeCall call)
Receive a notification from the signaling channel that a call has been created
|
void |
callTerminated(RespokeCall call)
Receive a notification from the signaling channel that a call has terminated
|
RespokeCall |
callWithID(java.lang.String sessionID)
Find a call with the specified session ID
|
void |
connect(java.lang.String tokenID,
java.lang.Object initialPresence,
android.content.Context context,
RespokeClient.ConnectCompletionListener completionListener)
Connect to the Respoke infrastructure and authenticate with the specified brokered auth token ID.
|
void |
connect(java.lang.String endpointID,
java.lang.String appID,
boolean shouldReconnect,
java.lang.Object initialPresence,
android.content.Context context,
RespokeClient.ConnectCompletionListener completionListener)
Connect to the Respoke infrastructure and authenticate in development mode using the specified endpoint ID and app ID.
|
void |
directConnectionAvailable(RespokeDirectConnection directConnection,
RespokeEndpoint endpoint)
This event is fired when the logged-in endpoint is receiving a request to open a direct connection
to another endpoint.
|
void |
disconnect()
Disconnect from the Respoke infrastructure, leave all groups, invalidate the token, and disconnect the websocket.
|
RespokeConnection |
getConnection(java.lang.String connectionID,
java.lang.String endpointID,
boolean skipCreate)
Find a Connection by id and return it.
|
RespokeEndpoint |
getEndpoint(java.lang.String endpointIDToFind,
boolean skipCreate)
Find an endpoint by id and return it.
|
java.lang.String |
getEndpointID()
Return the Endpoint ID of this client
|
RespokeGroup |
getGroup(java.lang.String groupIDToFind)
Returns the group with the specified ID
|
void |
getGroupHistories(java.util.List<java.lang.String> groupIds,
java.lang.Integer maxMessages,
RespokeClient.GroupHistoriesCompletionListener completionListener)
Retrieve the history of messages that have been persisted for 1 or more groups.
|
void |
getGroupHistories(java.util.List<java.lang.String> groupIds,
RespokeClient.GroupHistoriesCompletionListener completionListener)
Retrieve the history of messages that have been persisted for 1 or more groups.
|
void |
getGroupHistory(java.lang.String groupId,
java.lang.Integer maxMessages,
java.util.Date before,
RespokeClient.GroupHistoryCompletionListener completionListener)
Retrieve the history of messages that have been persisted for a specific group.
|
void |
getGroupHistory(java.lang.String groupId,
java.lang.Integer maxMessages,
RespokeClient.GroupHistoryCompletionListener completionListener)
Retrieve the history of messages that have been persisted for a specific group.
|
void |
getGroupHistory(java.lang.String groupId,
RespokeClient.GroupHistoryCompletionListener completionListener)
Retrieve the history of messages that have been persisted for a specific group.
|
java.lang.Object |
getPresence()
Get the current presence of this client
|
RespokeClient.ResolvePresenceListener |
getResolvePresenceListener()
Get the current receiver for the ResolvePresenceListener interface
|
boolean |
isConnected()
Check whether this client is connected to the backend infrastructure.
|
RespokeCall |
joinConference(RespokeCall.Listener callListener,
android.content.Context context,
java.lang.String conferenceID)
Initiate a call to a conference.
|
void |
joinGroups(java.util.ArrayList<java.lang.String> groupIDList,
RespokeClient.JoinGroupCompletionListener completionListener)
Join a list of Groups and begin keeping track of them.
|
void |
onConnect(RespokeSignalingChannel sender,
java.lang.String endpointID,
java.lang.String connectionID)
Receive a notification from the signaling channel that it has connected to the cloud infrastructure
|
void |
onDisconnect(RespokeSignalingChannel sender)
Receive a notification from the signaling channel that it has disconnected to the cloud infrastructure
|
void |
onError(java.lang.String errorMessage,
RespokeSignalingChannel sender)
Receive a notification from the signaling channel that an error has occurred
|
void |
onGroupMessage(java.lang.String message,
java.lang.String groupID,
java.lang.String endpointID,
RespokeSignalingChannel sender,
java.util.Date timestamp)
Receive a notification that a group message was received
|
void |
onIncomingCall(org.json.JSONObject sdp,
java.lang.String sessionID,
java.lang.String connectionID,
java.lang.String endpointID,
java.lang.String fromType,
java.util.Date timestamp,
RespokeSignalingChannel sender)
Receive a notification from the signaling channel that a remote endpoint is attempting to start a call
|
void |
onIncomingDirectConnection(org.json.JSONObject sdp,
java.lang.String sessionID,
java.lang.String connectionID,
java.lang.String endpointID,
java.util.Date timestamp,
RespokeSignalingChannel sender)
Receive a notification from the signaling channel that a remote endpoint is attempting to start a direct connection
|
void |
onJoinGroup(java.lang.String groupID,
java.lang.String endpointID,
java.lang.String connectionID,
RespokeSignalingChannel sender)
Receive a notification from the signaling channel that an endpoint has joined this group.
|
void |
onLeaveGroup(java.lang.String groupID,
java.lang.String endpointID,
java.lang.String connectionID,
RespokeSignalingChannel sender)
Receive a notification from the signaling channel that an endpoint has left this group.
|
void |
onMessage(java.lang.String message,
java.util.Date timestamp,
java.lang.String fromEndpointID,
java.lang.String toEndpointID,
RespokeSignalingChannel sender)
Receive a notification from the signaling channel that a message has been sent to this group
|
void |
onPresence(java.lang.Object presence,
java.lang.String connectionID,
java.lang.String endpointID,
RespokeSignalingChannel sender)
Receive a notification that a presence change message was received
|
void |
registerPushServicesWithToken(java.lang.String token)
Register the client to receive push notifications when the socket is not active
|
void |
setListener(RespokeClient.Listener listener)
Set a receiver for the Listener interface
|
void |
setPresence(java.lang.Object newPresence,
Respoke.TaskCompletionListener completionListener)
Set the presence on the client session
|
void |
setResolvePresenceListener(RespokeClient.ResolvePresenceListener listener)
Set a receiver for the ResolvePresenceListener interface
|
void |
unregisterFromPushServices(Respoke.TaskCompletionListener completionListener)
Unregister this client from the push service so that no more notifications will be received for this endpoint ID
|
public static final java.lang.String PROPERTY_LAST_VALID_PUSH_TOKEN
public static final java.lang.String PROPERTY_LAST_VALID_PUSH_TOKEN_ID
public java.lang.String baseURL
public void setListener(RespokeClient.Listener listener)
listener - The new receiver for events from the Listener interface for this client instancepublic void setResolvePresenceListener(RespokeClient.ResolvePresenceListener listener)
listener - The new receiver for events from the ResolvePresenceListener interface for this client instancepublic RespokeClient.ResolvePresenceListener getResolvePresenceListener()
public void connect(java.lang.String endpointID,
java.lang.String appID,
boolean shouldReconnect,
java.lang.Object initialPresence,
android.content.Context context,
RespokeClient.ConnectCompletionListener completionListener)
endpointID - The endpoint ID to use when connectingappID - Your Application IDshouldReconnect - Whether or not to automatically reconnect to the Respoke service when a disconnect occurs.initialPresence - The optional initial presence value to set for this clientcontext - An application context with which to access system resourcescompletionListener - A listener to be called when an error occurs, passing a string describing the errorpublic void connect(java.lang.String tokenID,
java.lang.Object initialPresence,
android.content.Context context,
RespokeClient.ConnectCompletionListener completionListener)
tokenID - The token ID to use when connectinginitialPresence - The optional initial presence value to set for this clientcontext - An application context with which to access system resourcescompletionListener - A listener to be called when an error occurs, passing a string describing the errorpublic void disconnect()
public boolean isConnected()
public void joinGroups(java.util.ArrayList<java.lang.String> groupIDList,
RespokeClient.JoinGroupCompletionListener completionListener)
groupIDList - An array of IDs of the groups to joincompletionListener - A listener to receive a notification of the success or failure of the asynchronous operationpublic RespokeConnection getConnection(java.lang.String connectionID, java.lang.String endpointID, boolean skipCreate)
connectionID - The ID of the connection to returnendpointID - The ID of the endpoint to which this connection belongsskipCreate - If true, return null if the connection is not already knownpublic RespokeCall joinConference(RespokeCall.Listener callListener, android.content.Context context, java.lang.String conferenceID)
callListener - A listener to receive notifications about the new callcontext - An application context with which to access system resourcesconferenceID - The ID of the conference to callpublic RespokeEndpoint getEndpoint(java.lang.String endpointIDToFind, boolean skipCreate)
endpointIDToFind - The ID of the endpoint to returnskipCreate - If true, return null if the connection is not already knownpublic RespokeGroup getGroup(java.lang.String groupIDToFind)
groupIDToFind - The ID of the group to findpublic void getGroupHistories(java.util.List<java.lang.String> groupIds,
RespokeClient.GroupHistoriesCompletionListener completionListener)
groupIds - The groups to pull history forcompletionListener - The callback called when this async operation has completedpublic void getGroupHistories(java.util.List<java.lang.String> groupIds,
java.lang.Integer maxMessages,
RespokeClient.GroupHistoriesCompletionListener completionListener)
groupIds - The groups to pull history formaxMessages - The maximum number of messages per group to pull. Must be >= 1completionListener - The callback called when this async operation has completedpublic void getGroupHistory(java.lang.String groupId,
RespokeClient.GroupHistoryCompletionListener completionListener)
groupId - The groups to pull history forcompletionListener - The callback called when this async operation has completedpublic void getGroupHistory(java.lang.String groupId,
java.lang.Integer maxMessages,
RespokeClient.GroupHistoryCompletionListener completionListener)
groupId - The groups to pull history formaxMessages - The maximum number of messages per group to pull. Must be >= 1completionListener - The callback called when this async operation has completedpublic void getGroupHistory(java.lang.String groupId,
java.lang.Integer maxMessages,
java.util.Date before,
RespokeClient.GroupHistoryCompletionListener completionListener)
groupId - The groups to pull history formaxMessages - The maximum number of messages per group to pull. Must be >= 1before - Limit messages to those with a timestamp before this valuecompletionListener - The callback called when this async operation has completedpublic java.lang.String getEndpointID()
public void setPresence(java.lang.Object newPresence,
Respoke.TaskCompletionListener completionListener)
newPresence - The new presence to usecompletionListener - A listener to receive the notification on the success or failure of the asynchronous operationpublic java.lang.Object getPresence()
public void registerPushServicesWithToken(java.lang.String token)
token - The GCMS token to registerpublic void unregisterFromPushServices(Respoke.TaskCompletionListener completionListener)
completionListener - A listener to receive the notification on the success or failure of the asynchronous operationpublic void onConnect(RespokeSignalingChannel sender, java.lang.String endpointID, java.lang.String connectionID)
RespokeSignalingChannel.ListeneronConnect in interface RespokeSignalingChannel.Listenersender - The signaling channel that triggered the eventendpointID - The endpointID for this connection, as reported by the serverpublic void onDisconnect(RespokeSignalingChannel sender)
RespokeSignalingChannel.ListeneronDisconnect in interface RespokeSignalingChannel.Listenersender - The signaling channel that triggered the eventpublic void onIncomingCall(org.json.JSONObject sdp,
java.lang.String sessionID,
java.lang.String connectionID,
java.lang.String endpointID,
java.lang.String fromType,
java.util.Date timestamp,
RespokeSignalingChannel sender)
RespokeSignalingChannel.ListeneronIncomingCall in interface RespokeSignalingChannel.Listenersdp - The SDP data for the callsessionID - The session ID of the callconnectionID - The connectionID that is callingendpointID - The endpointID that is callingtimestamp - The timestamp when the call was initiatedsender - The signaling channel that triggered the eventpublic void onIncomingDirectConnection(org.json.JSONObject sdp,
java.lang.String sessionID,
java.lang.String connectionID,
java.lang.String endpointID,
java.util.Date timestamp,
RespokeSignalingChannel sender)
RespokeSignalingChannel.ListeneronIncomingDirectConnection in interface RespokeSignalingChannel.Listenersdp - The SDP data for the directConnectionsessionID - The session ID of the directConnectionconnectionID - The connectionID that is callingendpointID - The endpointID that is callingtimestamp - The timestamp when the call was initiatedsender - The signaling channel that triggered the eventpublic void onError(java.lang.String errorMessage,
RespokeSignalingChannel sender)
RespokeSignalingChannel.ListeneronError in interface RespokeSignalingChannel.ListenererrorMessage - Error messagesender - The signaling channel that triggered the eventpublic void onJoinGroup(java.lang.String groupID,
java.lang.String endpointID,
java.lang.String connectionID,
RespokeSignalingChannel sender)
RespokeSignalingChannel.ListeneronJoinGroup in interface RespokeSignalingChannel.ListenergroupID - The ID of the group triggering the join messageendpointID - The ID of the endpoint that to which the connection belongsconnectionID - The ID of the connection that has joined the groupsender - The signaling channel that triggered the eventpublic void onLeaveGroup(java.lang.String groupID,
java.lang.String endpointID,
java.lang.String connectionID,
RespokeSignalingChannel sender)
RespokeSignalingChannel.ListeneronLeaveGroup in interface RespokeSignalingChannel.ListenergroupID - The ID of the group triggering the leave messageendpointID - The ID of the endpoint that to which the connection belongsconnectionID - The ID of the connection that has left the groupsender - The signaling channel that triggered the eventpublic void onMessage(java.lang.String message,
java.util.Date timestamp,
java.lang.String fromEndpointID,
java.lang.String toEndpointID,
RespokeSignalingChannel sender)
RespokeSignalingChannel.ListeneronMessage in interface RespokeSignalingChannel.Listenermessage - The body of the messagetimestamp - The timestamp of the messagefromEndpointID - The ID of the endpoint sending the messagetoEndpointID - The ID of the original recipient of the message if being cc'd to self, otherwise nullsender - The signaling channel that triggered the eventpublic void onGroupMessage(java.lang.String message,
java.lang.String groupID,
java.lang.String endpointID,
RespokeSignalingChannel sender,
java.util.Date timestamp)
RespokeSignalingChannel.ListeneronGroupMessage in interface RespokeSignalingChannel.Listenermessage - The body of the messagegroupID - The ID of the group to which the message was sentendpointID - The ID of the endpoint that sent the messagesender - The signaling channel that triggered the eventtimestamp - The time at which the message was sentpublic void onPresence(java.lang.Object presence,
java.lang.String connectionID,
java.lang.String endpointID,
RespokeSignalingChannel sender)
RespokeSignalingChannel.ListeneronPresence in interface RespokeSignalingChannel.Listenerpresence - The new presence valueconnectionID - The connection ID whose presence changedendpointID - The endpoint ID to which the connection belongssender - The signaling channel that triggered the eventpublic void callCreated(RespokeCall call)
RespokeSignalingChannel.ListenercallCreated in interface RespokeSignalingChannel.Listenercall - The RespokeCall instance that was createdpublic void callTerminated(RespokeCall call)
RespokeSignalingChannel.ListenercallTerminated in interface RespokeSignalingChannel.Listenercall - The RespokeCall instance that was terminatedpublic RespokeCall callWithID(java.lang.String sessionID)
RespokeSignalingChannel.ListenercallWithID in interface RespokeSignalingChannel.ListenersessionID - SessionID to findpublic void directConnectionAvailable(RespokeDirectConnection directConnection, RespokeEndpoint endpoint)
RespokeSignalingChannel.ListenerdirectConnectionAvailable in interface RespokeSignalingChannel.ListenerdirectConnection - The direct connection objectendpoint - The remote endpoint