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() |
Properties |
---|
Events | |
---|---|
Invoked when the StringeeClient is connected. |
|
Invoked when the StringeeClient is disconnected. |
|
Invoked when StringeeClient connect false. |
|
Invoked when your token is expired. |
|
Invoked when get Custom message. |
|
Invoked when receive an incoming of StringeeCall. |
|
Invoked when receive an incoming of StringeeCall2. |
|
Invoked when receive a chat request. |
|
Invoked when receive a transfer chat request. |
|
Invoked when chat request to agent timeout. |
|
Invoked when no agent accept chat request and time out. |
|
Invoked when conversation end. |
|
Invoked when user send begin typing. |
|
Invoked when user send end typing. |
Methods |
---|
connect(String token) → result Connects to Stringee server. |
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. |
StringeeClient() |
---|
Create a new StringeeClient. |
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. |
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. |
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. |