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 an chat change event. |
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. |
createConversation(StringeeConversationOption options, List<User> participants) → result Create a new StringeeConversation. |
getConversationById(String convId) → result Get the StringeeConversation by conversation id. |
getConversationByUserId(String userId) → result Get the StringeeConversation by user id. |
getLocalConversations() → result Get list of StringeeConversation in local database. |
getLastConversation(int count) → result Get lastest list of StringeeConversation. |
getConversationsBefore(int count, int datetime) → result Get list of StringeeConversation which have updated time smaller than datetime. |
getConversationsAfter(int count, int datetime) → result Get list of StringeeConversation which have updated time greater than datetime. |
Clear local database. |
Get count of unread StringeeConversation. |
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'] |
didReceiveObjectChange |
---|
Invoked when receive an chat change event. Receive StringeeObjectChange from event['body'] |
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. |
createConversation(ConversationOption options, List<User> participants) → result |
---|
Create a new conversation. If success return created StringeeConversation in result['body']. |
getConversationById(String convId) → result |
---|
Get the conversation by a conversation id. If success return StringeeConversation in result['body']. |
getConversationByUserId(String token) → result |
---|
Get the chat 1-1 conversation with other user by other user's id. If success return StringeeConversation in result['body']. |
getLocalConversation() → result |
---|
Get all conversations were saved in local database. If success List<StringeeConversation> in result['body']. |
getLastConversation(int count) → result |
---|
Get lastest list of conversations from Stringee server. If success return List<StringeeConversation> in result['body']. |
getConversationsBefore(int count, int datetime) → result |
---|
Get list of conversation which have updated time smaller than datetime from Stringee server. If success return List<StringeeConversation> in result['body']. |
getConversationsAfter(int count, int datetime) → result |
---|
Get list of conversation which have updated time greater than datetime from Stringee server. If success return List<StringeeConversation> in result['body']. |
clearDb() → result |
---|
Clear local database. |
getTotalUnread() → result |
---|
Get count of unread conversation. |