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 StringeeConversation, receives the connection's events, the incoming call event, StringeeConversation and StringeeMessage change event.


Constructors


StringeeClient({List<StringeeServerAddress>? serverAddresses, String? baseAPIUrl, String? stringeeXBaseUrl})

Create a new StringeeClient.


Properties


userIdString?

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

projectIdString?

It's the unique identification of the project created on https://developer.stringee.com/.

hasConnectedbool

Whether the client connects to Stringee server:

isReconnectingbool

Whether the client trying to reconnect to Stringee server:


Methods


registerEvent(StringeeClientListener clientListener)void

Register to listen to events from StringeeClient.

connect(String token)Map<dynamic, dynamic>

Connect to Stringee server using the provided access token.

disconnect()Map<dynamic, dynamic>

Disconnect from Stringee server.

registerPush(String deviceToken, {bool? isProduction, bool? isVoip})Map<dynamic, dynamic>

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

registerPushAndDeleteOthers(String deviceToken, List packageNames, {bool? isProduction, bool? isVoip})Map<dynamic, dynamic>

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

unregisterPush(String deviceToken)Map<dynamic, dynamic>

Remove the registration deviceToken for push notifications from Stringee server.

sendCustomMessage(String userId, Map<dynamic, dynamic> customData)Map<dynamic, dynamic>

Send a custom message to a user.

getChatProfile(String key)Map<dynamic, dynamic>

Get chat profile. If successful return StringeeChatProfile in callBack['body'].

getLiveChatToken(String key, String name, String email)Map<dynamic, dynamic>

Get live chat token for connecting to Stringee. If successful return token in callBack['body'].

updateUserInfo(StringeeUser user)Map<dynamic, dynamic>

Update user info.

getUserInfo(List userIds)Map<dynamic, dynamic>

Get user info. If successful return user in callBack['body'].

createLiveChatConversation(String queueId, {String? customData})Map<dynamic, dynamic>

Create a new live chat Conversation. If successful return a created StringeeConversation in callBack['body'].

createLiveChatTicket(String key, String name, String email, String description, {String? phone})Map<dynamic, dynamic>

Create a live chat ticket.

createConversation(StringeeConversationOption options, List<StringeeUser> participants)Map<dynamic, dynamic>

Create a new conversation. If successful return a created StringeeConversation in callBack['body'].

getConversationById(String convId)Map<dynamic, dynamic>

Get the conversation by a conversation id. If successful return a StringeeConversation in callBack['body'].

getConversationByUserId(String userId)Map<dynamic, dynamic>

Get the chat 1-1 conversation with other user by other user's id. If successful return a StringeeConversation in callBack['body'].

getLocalConversations()Map<dynamic, dynamic>

Get all conversations were saved in local database. If successful return a list of StringeeConversation in callBack['body'].

_getLocalConversationsByChannelType(List<ChannelType> channels, {bool isEnded = false})Map<dynamic, dynamic>_

Get all conversations with ChannelType were saved in local database. If successful return a list of StringeeConversation in callBack['body'].

getLastConversation(int count, {StringeeConversationFilter? conversationFilter})Map<dynamic, dynamic>

Get lastest list of conversations from Stringee server. If successful return a list of StringeeConversation in callBack['body'].

getLastUnreadConversations(int count, {StringeeConversationFilter? conversationFilter})Map<dynamic, dynamic>

Get lastest list of unread conversations from Stringee server. If successful return a list of StringeeConversation in callBack['body'].

getConversationsBefore(int count, int datetime, {StringeeConversationFilter? conversationFilter})Map<dynamic, dynamic>

Get list of conversation which have updated time smaller than datetime from Stringee server. If successful return a list of StringeeConversation in callBack['body'].

getUnreadConversationsBefore(int count, int datetime, {StringeeConversationFilter? conversationFilter})Map<dynamic, dynamic>

Get list of unread conversation which have updated time smaller than datetime from Stringee server. If successful return a list of StringeeConversation in callBack['body'].

getConversationsAfter(int count, int datetime, {StringeeConversationFilter? conversationFilter})Map<dynamic, dynamic>

Get list of conversation which have updated time greater than datetime from Stringee server. If successful return a list of StringeeConversation in callBack['body'].

getUnreadConversationsAfter(int count, int datetime, {StringeeConversationFilter? conversationFilter})Map<dynamic, dynamic>

Get list of unread conversation which have updated time greater than datetime from Stringee server. If successful return a list of StringeeConversation in callBack['body'].

clearDb()Map<dynamic, dynamic>

Clear local database.

getTotalUnread()Map<dynamic, dynamic>

Get count of unread conversation. If successful return count of unread StringeeConversation in callBack['body'].

getChatRequest()Map<dynamic, dynamic>

Get list of chat request from Stringee server. If successful return a list of StringeeChatRequest in callBack['body'].

blockUser(String userId)Map<dynamic, dynamic>

Block a user with userId in chat.

preventAddingToGroup(String convId)Map<dynamic, dynamic>

Prevent adding to conversation with conversation id.

setTrustAllSsl(bool trustAll)Map<dynamic, dynamic>

Set connection trust all ssl.

enableSSLSpinning(List certificateNames)Map<dynamic, dynamic>

Set connection list ssl with certificate.

enableSSLSpinningWithPublicKeys(List publicKeys)Map<dynamic, dynamic>

Set connection list ssl with public key. For Android, using public key. For Ios, using RSA public key.

destroy()void

Close event stream.