Suggestions

close search

StringeeClient class

Represents a Stringee client, manages the client's connection. This class provides methods to connect to/disconnect from Stringee server, manage Conversation, receives the connection's events, the incoming call event, Conversation and Message change event.


Constructors


StringeeClient({serverAddresses: Array<StringeeServerAddress>, baseUrl: string, stringeeXBaseUrl: string})

Create a new StringeeClient.


Properties


userId: string

It's the unique identifier of the client on Stringee system.

isConnected: boolean

Whether the client connects to Stringee server:


Methods


setListener(stringeeClientListener: StringeeClientListener): void

Set listener for StringeeClient.

connect(token: string): void

Connect to Stringee server using the provided access token.

disconnect(): void

Disconnect from Stringee server.

registerPush(deviceToken: string, isProduction: boolean, isVoip: boolean): Promise<void>

Register the registration deviceToken for push notifications to Stringee server. For iOS need 2 values for register push:

registerPushAndDeleteOthers(deviceToken: string, isProduction: boolean, isVoip: boolean, packageNames: Array<string>): Promise<void>

Register the registration deviceToken for push notifications to Stringee server, and remove the other registration deviceToken with packageNames. For iOS need 2 values for register push:

unregisterPush(deviceToken: string): Promise<void>

Remove the registration deviceToken for push notifications from Stringee server.

sendCustomMessage(toUserId: string, message: string): Promise<void>

Send a custom message to a user.

createConversation(userIds: Array<string>, options: ConversationOption): Promise<Conversation>

Create a new conversation. If successful return a created Conversation.

getConversationById(convId: string): Promise<Conversation>

Get the conversation by a conversation identifier. If successful return a Conversation.

getLocalConversations(userId: string, count: number, isAscending: boolean): Promise<Array<Conversation>>

Get all conversations were saved in local database. If successful return a list of Conversation.

getLastConversation(count: number, isAscending: boolean): Promise<Array<Conversation>>

Get lastest list of conversations from Stringee server. If successful return a list of Conversation.

getAllLastConversations(count: number, isAscending: boolean): Promise<Array<Conversation>>

Get lastest list of conversations including deleted conversations from Stringee server. If successful return a list of Conversation.

getLastUnreadConversations(count: number, isAscending: boolean): Promise<Array<Conversation>>

Get lastest list of unread conversations from Stringee server. If successful return a list of Conversation.

getConversationsAfter(datetime: number, count: number, isAscending: boolean): Promise<Array<Conversation>>

Get list of conversations which have updated time greater than datetime from Stringee server. If successful return a list of Conversation.

getAllConversationsAfter(datetime: number, count: number, isAscending: boolean): Promise<Array<Conversation>>

Get list of conversations which including deleted conversations have updated time greater than datetime from Stringee server. If successful return a list of Conversation.

getUnreadConversationsAfter(datetime: number, count: number, isAscending: boolean): Promise<Array<Conversation>>

Get list of unread conversations which have updated time greater than datetime from Stringee server. If successful return a list of Conversation.

getConversationsBefore(datetime: number, count: number, isAscending: boolean): Promise<Array<Conversation>>

Get list of conversations which have updated time smaller than datetime from Stringee server. If successful return a list of Conversation.

getAllConversationsBefore(datetime: number, count: number, isAscending: boolean): Promise<Array<Conversation>>

Get list of conversations including deleted conversations which have updated time smaller than datetime from Stringee server. If successful return a list of Conversation.

getUnreadConversationsBefore(datetime: number, count: number, isAscending: boolean): Promise<Array<Conversation>>

Get list of unread conversations which have updated time smaller than datetime from Stringee server. If successful return a list of Conversation.

getConversationWithUser(userId: string): Promise<Conversation>

Get the chat 1-1 conversation with other user by other user's identifier. If successful return a Conversation.

getUnreadConversationCount(): Promise<number>

Get count of unread conversation. If successful return count of unread Conversation.

clearDb(): Promise<void>

Clear local database.

getUserInfo(userIds: Array<string>): Promise<Array<User>>

Get user info. If successful return User.

getChatProfile(widgetKey: string): Promise<any>

Get chat profile. If successful return chatProfile including a list of queues.

getLiveChatToken(widgetKey: string, name: string, email: string): Promise<string>

Get live chat token for connecting to Stringee. If successful return token.

updateUserInfo(userInfo: UserInfo): Promise<void>

Update user info.

createLiveChatConversation(queueId: string): Promise<Conversation>

Create a new live chat Conversation. If successful return a created Conversation.

createLiveChatTicket(widgetKey: string, liveChatTicketParam: LiveChatTicketParam): Promise<void>

Create a live chat ticket by using LiveChatTicketParam.