Suggestions

close search

StringeeClient

public class StringeeClient



Represents a Stringee client, manages connection, call, chat, and room events.



Summary


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

Creates a StringeeClient instance.

Properties
String? userId

Current connected user id.

String? projectId

Current project id.

bool hasConnected

Whether the client is connected.

bool isReconnecting

Whether the current connection event is a reconnect.

StreamController<dynamic> eventStreamController

Stream of client, call, chat, and room events for this client instance.

String uuid

Unique native client instance id.

Events
StringeeClientEvents didConnect

Invoked when the client connects successfully.

StringeeClientEvents didDisconnect

Invoked when the client disconnects.

StringeeClientEvents didFailWithError

Invoked when connection fails; body contains code and message.

StringeeClientEvents requestAccessToken

Invoked when a new access token is required.

StringeeClientEvents didReceiveCustomMessage

Invoked when the client receives a custom message.

StringeeClientEvents incomingCall

Invoked for an incoming StringeeCall.

StringeeClientEvents incomingCall2

Invoked for an incoming StringeeCall2.

StringeeClientEvents didReceiveChatRequest

Invoked when a live chat request is received.

StringeeClientEvents didReceiveTransferChatRequest

Invoked when a transferred live chat request is received.

StringeeClientEvents timeoutAnswerChat

Invoked when answering a chat request times out.

StringeeClientEvents timeoutInQueue

Invoked when the visitor times out in queue.

StringeeClientEvents conversationEnded

Invoked when a conversation is ended.

StringeeClientEvents userBeginTyping

Invoked when a user begins typing.

StringeeClientEvents userEndTyping

Invoked when a user ends typing.

Public methods
Future<Map<dynamic, dynamic>> connect(String token)

Connects this client with an access token.

Future<Map<dynamic, dynamic>> disconnect()

Disconnects this client from Stringee.

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

Registers a push notification token.

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

Registers a push token and removes tokens from the provided package names.

Future<Map<dynamic, dynamic>> unregisterPush(String deviceToken)

Unregisters a push notification token.

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

Sends custom data to a Stringee user.

Future<Result> existCall(String callId)

Checks whether a call exists on the Stringee server.

Future<Map<dynamic, dynamic>> setTrustAllSsl(bool trustAll)

Enables or disables trusting all SSL certificates on Android.

Constructors


StringeeClient({List<StringeeServerAddress>? serverAddresses, String? baseAPIUrl})
Creates a StringeeClient instance.

Properties


userId
Current connected user id.
projectId
Current project id.
hasConnected
Whether the client is connected.
isReconnecting
Whether the current connection event is a reconnect.
eventStreamController
Stream of client, call, chat, and room events for this client instance.
uuid
Unique native client instance id.

Events


didConnect
Invoked when the client connects successfully.
didDisconnect
Invoked when the client disconnects.
didFailWithError
Invoked when connection fails; body contains code and message.
requestAccessToken
Invoked when a new access token is required.
didReceiveCustomMessage
Invoked when the client receives a custom message.
incomingCall
Invoked for an incoming StringeeCall.
incomingCall2
Invoked for an incoming StringeeCall2.
didReceiveChatRequest
Invoked when a live chat request is received.
didReceiveTransferChatRequest
Invoked when a transferred live chat request is received.
timeoutAnswerChat
Invoked when answering a chat request times out.
timeoutInQueue
Invoked when the visitor times out in queue.
conversationEnded
Invoked when a conversation is ended.
userBeginTyping
Invoked when a user begins typing.
userEndTyping
Invoked when a user ends typing.

Public methods


connect(String token)
Connects this client with an access token.
disconnect()
Disconnects this client from Stringee.
registerPush(String deviceToken, {bool? isProduction, bool? isVoip})
Registers a push notification token.
registerPushAndDeleteOthers(String deviceToken, List<String> packageNames, {bool? isProduction, bool? isVoip})
Registers a push token and removes tokens from the provided package names.
unregisterPush(String deviceToken)
Unregisters a push notification token.
sendCustomMessage(String userId, Map<dynamic, dynamic> customData)
Sends custom data to a Stringee user.
existCall(String callId)
Checks whether a call exists on the Stringee server.
setTrustAllSsl(bool trustAll)
Enables or disables trusting all SSL certificates on Android.