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: |
onIncomingCall2 : 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 call2: |
onCustomMessage : Function(data: string) |
Invoked when the client get custom message: |
onObjectChange : Function(objectType: int, changeType: int, objectChanges: Object) |
Invoked when the client receives an object change of chat: |
onReceiveChatRequest : Function(request: ChatRequest) |
Invoked when the client receives chat request. |
onReceiveTransferChatRequest : Function(request: ChatRequest) |
Invoked when the client receives transfer chat request. |
onTimeoutAnswerChat : Function(request: ChatRequest) |
Invoked when chat request time out rout to agent. |
onTimeoutInQueue : Function(convId: string, customerId: string, customerName: string) |
Invoked when chat request time out route to agent: |
onConversationEnded : Function(convId: string, endedby: string) |
Invoked when the conversation is ended: |
onUserBeginTyping : Function(convId: string, userId: string, displayName: string) |
Invoked when the user send begin typing: |
onUserEndTyping : Function(convId: string, userId: string, displayName: string) |
Invoked when the user send begin typing: |
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 |
updateConversation(conversationId: String, params: map, callback: (status, code, message)) |
Update a conversation |
markConversationAsRead(conversationId: String, callback: (status, code, message)) |
Mark a conversation as read |
getConversationWithUser(userId: String, callback: (status, code, message, conversation)) |
Return the existing conversation with given id of user. |
getUnreadConversationCount(callback: (status, code, message, count)) |
Return the number of unread conversation. |
sendBeginTyping(convId: string, callback: (status, code, message)) |
Send begin typing. |
sendEndTyping(convId: string, callback: (status, code, message)) |
Send end typing. |
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 |
getChatProfile(widgetKey: String, callback: (status, code, message, chatProfile)) |
Return a chat profile contain list of queue |
getLiveChatToken(widgetKey: String, name: string, email: string, callback: (status, code, message, token)) |
Return a token for connect to Stringee server |
updateUserInfo(name: string, email: string, avatar: string, callback: (status, code, message)) |
Update user info |
createLiveChatConversation(queueId: string, callback: (status, code, message, conversation)) |
Create a live chat conversation |
acceptChatRequest(request: ChatRequest, callback: (status, code, message)) |
Accept chat request |
rejectChatRequest(request: ChatRequest, callback: (status, code, message)) |
Reject chat request |
createLiveChatTicket(widgetKey: string, name: string, email: string, note: string, callback: (status, code, message)) |
Create a ticket of live chat |
sendChatTranscript(email: string, convId: string, domain: string, callback: (status, code, message)) |
Send a chat transcript |
endChat(convId: string, callback: (status, code, message)) |
Reject chat request |
pinMessage(convId: string, messageId: string, pin: boolean, callback: (status, code, message)) |
Pin or unpin a message. |
editMessage(convId: string, messageId: string, newContent: string, callback: (status, code, message)) |
Edit the content of a message. |
revokeMessage(convId: string, messageId: string, callback: (status, code, message)) |
Revoke a message. |