wamp_client 0.1.2 copy "wamp_client: ^0.1.2" to clipboard
wamp_client: ^0.1.2 copied to clipboard

outdated

A library for WAMP protocol client. WAMP is the Web Application Messaging Protocol (https://wamp-proto.org)

example/wamp_client_example.dart

import 'dart:async';
import 'package:wamp_client/wamp_client.dart';

Future main() async {
  var wamp = new WampClient('realm1')
    ..onConnect = (c) {
      c.subscribe('topic').then((s) async {
        await for (final ev in s) {
          print('ev $ev');
          //return;
        }
      });
      print('start sub');

      c.publish('topic').then((dynamic _) {
        print('published');
      });

      final pname = 'proc.17';

      c.register(pname, (a) {
        print('proc arg: $a');
        throw new WampArgs(<dynamic>[100], <String, dynamic>{'test': true});
        return a;
      }).then((WampRegistration regid) async {
        print('register ok $regid');
        await c.unregister(regid);
        print('unregister ok');
      }).catchError((dynamic e) {
        print('register error $e');
      });

      c.call(pname, <dynamic>[2, 3], <String, dynamic>{'hello': 'world!'}).then(
          (r) {
        print('result ${r.args} ${r.params}');
      }).catchError((dynamic e) {
        print('err $e');
      });
    };
  //await wamp.connect('ws://localhost:8080/ws');
  await wamp.connect('wss://portal.iniad.org:8201/');
}
3
likes
0
pub points
39%
popularity

Publisher

verified publisherkkazuo.com

A library for WAMP protocol client. WAMP is the Web Application Messaging Protocol (https://wamp-proto.org)

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on wamp_client