wamp_client 0.1.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 63

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 packages get

Alternatively, your editor might support pub get or flutter packages 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';
  
Version Uploaded Documentation Archive
0.1.2 Aug 4, 2018 Go to the documentation of wamp_client 0.1.2 Download wamp_client 0.1.2 archive
0.1.1 Jun 13, 2017 Go to the documentation of wamp_client 0.1.1 Download wamp_client 0.1.1 archive
0.0.1 Jun 11, 2017 Go to the documentation of wamp_client 0.0.1 Download wamp_client 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
26
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

We analyzed this package on Aug 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.11.8

Platforms

Detected platforms: Flutter, other

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

Suggestions

Package is pre-v1 release.

While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction of the API.

Fix lib/src/wamp_client_base.dart.

Analysis of lib/src/wamp_client_base.dart reported 3 hints:

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.

line 484 col 8: The method '_abort' isn't used.

Dependencies

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