Represents a Stringee client, manages the client's connection. This component provides methods to connect to/disconnect from Stringee server, receives the connection's events, the incoming call event.
eventHandlers: Object |
---|
Event handlers passed into the native StringeeClient instance. Example:
|
onConnect : Function(userId: string, projectId: string, isReconnecting: boolean) |
---|
Invoked when the client connects to Stringee server: |
onDisConnect : Function(userId: string, projectId: string, isReconnecting: boolean) |
Invoked when the client connects to Stringee server: |
onFailWithError : Function(userId: string, code: int, message: string) |
Invoked when the client fails to connect to Stringee server: |
onRequestAccessToken : Function() |
Invoked when the access token is expired. You must get a new token and reconnect. |
onIncomingCall : Function(userId: string, callId: string, from: string, to: string, fromAlias: string, toAlias: string, callType: int, isVideoCall: boolean, customDataFromYourServer: string) |
Invoked when the client receives an incoming call: |
connect(token: string) |
---|
Connects to Stringee server with an access token: |
disconnect() |
Disconnects from Stringee server. |
registerPush(deviceToken: string, isProduction: boolean, isVoip: boolean, callback:(status, code, message)) |
Register device token to receive push notification. When you have an incoming call, you receive a notification from Stringee server: |
unregisterPush(deviceToken: string, callback: (status, code, message)) |
Remove your device token from Stringee server. Your device will not receive push notification when you have an incoming call |
sendCustomMessage(toUserId: string,message: string, callback: (status, code, message)) |
Send a custom message to a user |
createConversation(userIds,options, callback: (status, code, message, conversation)) |
Construct a new conversation with the provided participants and options. |
getConversationById(conversationId: String, callback: (status, code, message, conversation)) |
Return the existing conversation with given ID. |
getLocalConversations(userId: String, count: String, callback: (status, code, message, conversations)) |
Return stored conversations. |
getLastConversations(count: String, callback: (status, code, message, conversations)) |
Return latest conversations from server. |
getConversationsAfter(datetime: long, count: String, callback: (status, code, message, conversations)) |
Return a list of conversations which have updated time greater than datetime from server. |
getConversationsBefore(datetime: long, count: String, callback: (status, code, message, conversations)) |
Return a list of conversations which have updated time smaller than datetime from server. |
deleteConversation(conversationId: String, callback: (status, code, message)) |
Delete a conversation |
addParticipants(conversationId: String, userIds: array, callback: (status, code, message, users)) |
Add participants to a conversation |
removeParticipants(conversationId: String, userIds: array, callback: (status, code, message, users)) |
Remove participants from a conversation |
markConversationAsRead(conversationId: String, callback: (status, code, message)) |
Mark a conversation as read |
sendMessage(message: map, callback: (status, code, message)) |
Send a message |
deleteMessage(conversationId: String, messageId: String, callback: (status, code, message)) |
Delete a message in a conversation |
getLocalMessages(conversationId: String, count: int, callback: (status, code, message,messages)) |
Return stored messages of a conversation |
getLastMessages(conversationId: String, count: int, callback: (status, code, message,messages)) |
Return latest messages of a conversation from server |
getMessagesAfter(conversationId: String, seq: long, count: int, callback: (status, code, message,messages)) |
Return a list of messages of a conversation from server which have sequence greater than seq |
getMessagesBefore(conversationId: String, seq: long, count: int, callback: (status, code, message,messages)) |
Return a list of messages of a conversation from server which have sequence smaller than seq |
clearDb(callback: (status, code, message)) |
Clear local database |
updateConversation(conversationId: String, params: map, callback: (status, code, message)) |
Update a conversation |