wamp_client 0.1.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 59

wamp_client #

A library for Dart WAMP client.

Usage #

A simple usage example:

import 'package:wamp_client/wamp_client.dart';

main() async {
  var wamp = new WampClient('your.realm1')
    ..onConnect = (c) {
      c.subscribe('your.topic').then((sub) async {
        await for (var event in sub) {
          ...
        }
      });
    };

  await wamp.connect('ws://localhost:8080/ws');
}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Changelog #

0.1.2 #

  • Fix for Dart 2.

0.1.1 #

  • Add unregister method.
  • Add prefix wildcard match option.

0.0.1 #

  • Initial version, created by Stagehand

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/');
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  wamp_client: ^0.1.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:wamp_client/wamp_client.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
40
Health:
Code health derived from static analysis. [more]
83
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

We analyzed this package on Nov 21, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:wamp_client/wamp_client.dart with components: io.

Health suggestions

Fix lib/src/wamp_client_base.dart. (-16.51 points)

Analysis of lib/src/wamp_client_base.dart reported 36 hints, including:

line 47 col 12: Unnecessary new keyword.

line 70 col 19: Unnecessary new keyword.

line 82 col 28: Unnecessary new keyword.

line 114 col 7: The value of the field '_sessionId' isn't used.

line 115 col 7: The value of the field '_sessionDetails' isn't used.

Maintenance suggestions

Package is getting outdated. (-29.59 points)

The package was last published 67 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.1 <3.0.0
Dev dependencies
test ^0.12.0