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.


Summary


Constructors
StringeeClient()
Properties

userId → String

projectId → String

hasConnected → bool

isReconnecting → bool

eventStreamController → StreamController<dynamic>

Events  

didConnect

Invoked when the StringeeClient is connected.

didDisconnect

Invoked when the StringeeClient is disconnected.

didFailWithError

Invoked when StringeeClient connect false.

requestAccessToken

Invoked when your token is expired.

didReceiveCustomMessage

Invoked when get Custom message.

incomingCall

Invoked when receive an incoming of StringeeCall.

incomingCall2

Invoked when receive an incoming of StringeeCall2.

didReceiveChatRequest

Invoked when receive a chat request.

didReceiveTransferChatRequest

Invoked when receive a transfer chat request.

timeoutAnswerChat

Invoked when chat request to agent timeout.

timeoutInQueue

Invoked when no agent accept chat request and time out.

conversationEnded

Invoked when conversation end.

userBeginTyping

Invoked when user send begin typing.

userEndTyping

Invoked when user send end typing.

Methods

connect(String token) → result

Connects to Stringee server.

disconected() → result

Disconnect from Stringee server.

registerPush(String deviceToken, {bool isProduction, bool isVoip}) → result

Register push notifications.

unregisterPush(String deviceToken) → result

Unregister push notifications.

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

Send a custom message.

Constructors


StringeeClient()
Create a new StringeeClient.

Properties


userId → String
It's the unique identification of the client on Stringee system.
projectId → String
It's the unique identification of the project created on https://developer.stringee.com/.
hasConnected → bool
Whether the client connects to Stringee server:
- true - connected.
- false - not connected.
isReconnecting → bool
Whether the client trying to reconnect to Stringee server:
- true - reconnecting.
- false - has connected/ can't connect.
eventStreamController → StreamController<dynamic>
It's controller of event stream which was sended from plugin.

Events


didConnect
Invoked when the StringeeClient is connected.
didDisconnect
Invoked when the StringeeClient is disconnected.
didFailWithErrorl
Invoked when StringeeClient connect false.
Receive from event['body']:
- code: error code.
- message: error message.
requestAccessToken
Invoked when your token is expired.
didReceiveCustomMessage
Invoked when get Custom message.
Receive from event['body']:
- from: sender's id.
- message: custom message.
incomingCall
Invoked when receive an incoming of StringeeCall.
Receive StringeeCall from event['body'].
incomingCall2
Invoked when receive an incoming of StringeeCall.
Receive StringeeCall2 from event['body'].
didReceiveChatRequest
Invoked when receive a chat request..
Receive StringeeChatRequest from event['body'].
didReceiveTransferChatRequest
Invoked when receive a transfer chat request.
Receive StringeeChatRequest from event['body'].
timeoutAnswerChat
Invoked when chat request to agent timeout.
Receive StringeeChatRequest from event['body'].
timeoutInQueue
Invoked when no agent accept chat request and time out.
Receive from event['body']:
- convId: conversation's id.
- customerId: customer's id.
- customerName: customer's name.
conversationEnded
Invoked when conversation end.
Receive from event['body']:
- convId: conversation's id.
- endedby: Id of user who end conversation.
userBeginTyping
Invoked when user send begin typing.
Receive from event['body']:
- convId: conversation's id.
- userId: Id of user who send.
- displayName: display name of user who send.
userEndTyping
Invoked when user send end typing.
Receive from event['body']:
- convId: conversation's id.
- userId: Id of user who send.
- displayName: display name of user who send.

Methods


connect(String token) → result
Connect to Stringee server using the provided access token.
disconected() → result
Disconnect from Stringee server.
registerPush(String deviceToken, {bool isProduction, bool isVoip}) → result
Register the registration deviceToken for push notifications to Stringee server.
For iOS need 2 values for register push:
- isProduction: true - For production environment, false - For development environment.
- isVoip: true - To receive voip push notification, false - To receive remote push notification.
unregisterPush(String deviceToken) → result
Remove the registration deviceToken for push notifications from Stringee server.
sendCustomMessage(String userId, Map<dynamic, dynamic> customData) → result
Send a custom message to a user.