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.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
|
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 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.Listener
onConnect
in interface RespokeSignalingChannel.Listener
sender
- The signaling channel that triggered the eventendpointID
- The endpointID for this connection, as reported by the serverpublic void onDisconnect(RespokeSignalingChannel sender)
RespokeSignalingChannel.Listener
onDisconnect
in interface RespokeSignalingChannel.Listener
sender
- 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.Listener
onIncomingCall
in interface RespokeSignalingChannel.Listener
sdp
- 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.Listener
onIncomingDirectConnection
in interface RespokeSignalingChannel.Listener
sdp
- 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.Listener
onError
in interface RespokeSignalingChannel.Listener
errorMessage
- 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.Listener
onJoinGroup
in interface RespokeSignalingChannel.Listener
groupID
- 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.Listener
onLeaveGroup
in interface RespokeSignalingChannel.Listener
groupID
- 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.Listener
onMessage
in interface RespokeSignalingChannel.Listener
message
- 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.Listener
onGroupMessage
in interface RespokeSignalingChannel.Listener
message
- 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.Listener
onPresence
in interface RespokeSignalingChannel.Listener
presence
- 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.Listener
callCreated
in interface RespokeSignalingChannel.Listener
call
- The RespokeCall instance that was createdpublic void callTerminated(RespokeCall call)
RespokeSignalingChannel.Listener
callTerminated
in interface RespokeSignalingChannel.Listener
call
- The RespokeCall instance that was terminatedpublic RespokeCall callWithID(java.lang.String sessionID)
RespokeSignalingChannel.Listener
callWithID
in interface RespokeSignalingChannel.Listener
sessionID
- SessionID to findpublic void directConnectionAvailable(RespokeDirectConnection directConnection, RespokeEndpoint endpoint)
RespokeSignalingChannel.Listener
directConnectionAvailable
in interface RespokeSignalingChannel.Listener
directConnection
- The direct connection objectendpoint
- The remote endpoint