Tinode class
Provides a simple interface to interact with tinode server using websocket
Constructors
- Tinode(String appName, ConnectionOptions options, bool loggerEnabled, {bool reset = false})
- Creates an instance of Tinode interface to interact with tinode server using websocket
Properties
- authService → AuthService
-
no setter
- cache → CacheManager
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isAuthenticated → bool
-
Specifies if user is authenticated
no setter
- isConnected → bool
-
Is current connection open
no setter
-
onConnected
↔ PublishSubject<
void> -
onConnected
event will be triggered when connection opensgetter/setter pair -
onDisconnect
↔ PublishSubject<
void> -
onDisconnect
event will be triggered when connection is closedgetter/setter pair -
onMessage
↔ PublishSubject<
ServerMessage> -
onMessage
event will be triggered when a message is receivedgetter/setter pair -
onNetworkProbe
↔ PublishSubject<
void> -
onNetworkProbe
event will be triggered when network prob packet is receivedgetter/setter pair -
onRawMessage
↔ PublishSubject<
String> -
onRawMessage
event will be triggered when a message is received value will be a jsongetter/setter pair - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- token → AuthToken?
-
Current user token
no setter
- userId → String
-
Current user id
no setter
- version → String
-
no setter
Methods
-
account(
String userId, String scheme, String secret, bool login, AccountParams? params) → Future - Create or update an account
-
connect(
) → Future - Open the connection and send a hello packet to server
-
createAccount(
String scheme, String secret, bool login, AccountParams? params) → Future -
Create a new user. Wrapper for
account
method -
createAccountBasic(
String username, String password, bool login, AccountParams? params) → Future -
Create user with 'basic' authentication scheme and immediately
use it for authentication. Wrapper for
createAccount
-
createMessage(
String topicName, dynamic data, bool echo) → Message - Create message draft without sending it to the server
-
deleteCredential(
String method, String value) → Future - Delete credential. Always sent on 'me' topic
-
deleteCurrentUser(
bool hard) → Future - Request to delete account of the current user
-
deleteMessages(
String topicName, List< DelRange> ranges, bool hard) → Future - Delete some or all messages in a topic
-
deleteSubscription(
String topicName, String userId) → Future - Delete subscription. Requires Share permission
-
deleteTopic(
String topicName, bool hard) → Future - Delete the topic all together. Requires Owner permission
-
disconnect(
) → void - Close the current connection
-
enableLogger(
bool enabled) → void - Enable or disable logger service
-
getAuthenticationToken(
) → AuthToken? - Get stored authentication token
-
getCurrentLogin(
) → String - Get login (user id) used for last successful authentication.
-
getCurrentUserId(
) → String - Get the user id of the the current authenticated user
-
getFndTopic(
) → TopicFnd - Instantiate 'fnd' (find) topic or get it from cache
-
getMeta(
String topicName, GetQuery params) → Future - Request topic metadata
-
getMeTopic(
) → TopicMe - Instantiate 'me' topic or get it from cache
-
getServerInfo(
) → ServerConfiguration - Return information about the server: protocol, version, limits, and build timestamp
-
getTopic(
String topicName) → Topic - Get a named topic, either pull it from cache or create a new instance There is a single instance of topic for each name
-
getTopicAccessMode(
String topicName) → AccessMode? - Get access mode for the given contact
-
hello(
{String? deviceToken}) → Future< CtrlMessage> - Say hello and set some initial configuration like:
-
isMe(
String userId) → bool - Check if the given user ID is equal to the current user's user id
-
isTopicCached(
String topicName) → bool - Check if named topic is already present in cache
-
isTopicOnline(
String topicName) → bool - Check if given topic is online
-
leave(
String topicName, bool unsubscribe) → Future - Detach and optionally unsubscribe from the topic
-
login(
String scheme, String secret, Map< String, dynamic> ? cred) → Future<CtrlMessage> - Authenticate current session
-
loginBasic(
String username, String password, Map< String, dynamic> ? cred) → Future<CtrlMessage> -
Wrapper for
login
with basic authentication -
loginToken(
String token, Map< String, dynamic> cred) → Future -
Wrapper for
login
with token authentication -
networkProbe(
) → void - Send a network probe message to make sure the connection is alive
-
newChannel(
) → Topic - Instantiate a new channel-enabled group topic. An actual name will be assigned by the server
-
newGroupTopicName(
bool isChan) → String - Generate unique name like 'new123456' suitable for creating a new group topic
-
newTopic(
) → Topic - Instantiate a new group topic. An actual name will be assigned by the server
-
newTopicWith(
String peerUserId) → Topic - Instantiate a new P2P topic with a given peer
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
note(
String topicName, String what, int seq) → void - Notify server that a message or messages were read or received. Does NOT return promise
-
noteKeyPress(
String topicName) → void - Broadcast a key-press notification to topic subscribers. Used to show typing notifications "user X is typing..."
-
publishMessage(
Message message) → Future -
Publish message to topic. The message should be created by
createMessage
-
requestResetSecret(
String scheme, String method, String value) → Future - Send a request for resetting an authentication secret
-
setDeviceToken(
String deviceToken) → Future< CtrlMessage> -
Wrapper for
hello
, sends hi packet again containing device token -
setHumanLanguage(
String language) → void - Set UI language to report to the server. Must be called before 'hi' is sent, otherwise it will not be used
-
setMeta(
String topicName, SetParams params) → Future - Update topic's metadata: description, subscriptions
-
subscribe(
String topicName, GetQuery getParams, SetParams setParams) → Future - Send a topic subscription request
-
toString(
) → String -
A string representation of this object.
inherited
-
updateAccountBasic(
String userId, String username, String password, AccountParams? params) → Future - Update account with basic
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited