tinode 1.0.0-alpha copy "tinode: ^1.0.0-alpha" to clipboard
tinode: ^1.0.0-alpha copied to clipboard

outdated

Implementation of Tinode SDK in dart.

example/tinode_example.dart

import 'package:tinode/tinode.dart';

void main(List<String> args) async {
  var key = 'AQEAAAABAAD_rAp4DJh05a1HAwFT3A6K';
  var host = 'sandbox.tinode.co';

  var tinode = Tinode('Moein', ConnectionOptions(apiKey: key, host: host, secure: true), false);
  await tinode.connect();
  print(tinode.isConnected);
  await tinode.loginBasic('alice', 'alice123', null);

  var me = tinode.getMeTopic();
  me.onSubsUpdated.listen((value) {
    for (var item in value) {
      print('Subscription: ' + item.public['fn'] + ' - Unread Messages:' + item.unread.toString());
    }
  });
  await me.subscribe(MetaGetBuilder(me).withLaterSub(null).build(), null);

  var grp = tinode.getTopic('grpNfK5pjIxPto');
  grp.onData.listen((value) {
    if (value != null) {
      print('DataMessage: ' + value.content);
    }
  });
  await grp.subscribe(MetaGetBuilder(grp).withLaterSub(null).withLaterData(null).build(), null);
  var msg = grp.createMessage('This is cool', true);
  await grp.publishMessage(msg);
}
6
likes
0
points
30
downloads

Publisher

unverified uploader

Weekly Downloads

Implementation of Tinode SDK in dart.

Homepage

License

unknown (license)

Dependencies

get_it, rxdart, web_socket_channel

More

Packages that depend on tinode