public class StringeeClient
Represents a Stringee client, manages connection, call, chat, and room events.
| Constructors | |
|---|---|
Constructor |
StringeeClient({List<StringeeServerAddress>? serverAddresses, String? baseAPIUrl})Creates a StringeeClient instance. |
| Properties | |
|---|---|
String? |
userIdCurrent connected user id. |
String? |
projectIdCurrent project id. |
bool |
hasConnectedWhether the client is connected. |
bool |
isReconnectingWhether the current connection event is a reconnect. |
StreamController<dynamic> |
eventStreamControllerStream of client, call, chat, and room events for this client instance. |
String |
uuidUnique native client instance id. |
| Events | |
|---|---|
StringeeClientEvents |
didConnectInvoked when the client connects successfully. |
StringeeClientEvents |
didDisconnectInvoked when the client disconnects. |
StringeeClientEvents |
didFailWithErrorInvoked when connection fails; body contains code and message. |
StringeeClientEvents |
requestAccessTokenInvoked when a new access token is required. |
StringeeClientEvents |
didReceiveCustomMessageInvoked when the client receives a custom message. |
StringeeClientEvents |
incomingCallInvoked for an incoming StringeeCall. |
StringeeClientEvents |
incomingCall2Invoked for an incoming StringeeCall2. |
StringeeClientEvents |
didReceiveChatRequestInvoked when a live chat request is received. |
StringeeClientEvents |
didReceiveTransferChatRequestInvoked when a transferred live chat request is received. |
StringeeClientEvents |
timeoutAnswerChatInvoked when answering a chat request times out. |
StringeeClientEvents |
timeoutInQueueInvoked when the visitor times out in queue. |
StringeeClientEvents |
conversationEndedInvoked when a conversation is ended. |
StringeeClientEvents |
userBeginTypingInvoked when a user begins typing. |
StringeeClientEvents |
userEndTypingInvoked 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. |
StringeeClient({List<StringeeServerAddress>? serverAddresses, String? baseAPIUrl}) |
|---|
| Creates a StringeeClient instance. |
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. |
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. |
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. |