connectanum 1.0.0-dev.4

  • Readme
  • Changelog
  • Installing
  • 63

connectanum-dart #

This is a WAMP client implementation for the dart language and flutter projects. The projects aims to provide a simple and extensible structure that is easy to use. With this project I want return something to the great WAMP-Protocol community.

WAMP is trademark of Crossbar.io Technologies GmbH.

TODOs #

  • add code coverage report
  • add github runners to test code with multiple dart versions
  • Multithreading for callee invocations
    • callee interrupt thread on incoming cancellations
  • better docs
  • msgpack serializer
  • unit test websocket transport
    • currently fails in browser, works in VM
  • get the auth id that called a method
  • handle ping pong times
  • auto reconnect handling, but keep abstract socket interface
    • difference between intentionally and unintentionally disconnect
    • websocket has error and regular close event. use them if possible or use close with internal state from this package?

Supported WAMP features #

Authentication #

Advanced RPC features #

  • ☑ Progressive Call Results
  • ☑ Progressive Calls
  • ☐ Call Timeouts
  • ☑ Call Canceling
  • ☑ Caller Identification
  • ☐ Call Trust Levels
  • ☑ Shared Registration
  • ☐ Sharded Registration

Advanced PUB/SUB features #

  • ☑ Subscriber Black- and Whitelisting
  • ☑ Publisher Exclusion
  • ☑ Publisher Identification
  • ☐ Publication Trust Levels
  • ☑ Pattern-based Subscriptions
  • ☐ Sharded Subscriptions
  • ☐ Subscription Revocation

Stream model #

The transport contains an incoming stream that is usually a single subscribe stream. A session will internally open a new broadcast stream as soon as the authentication process is successful. The transport stream subscription passes all incoming messages to the broad cast stream. If the transport stream is done, the broadcast stream will close as well. The broad cast stream is used to handle all session methods. The user will never touch the transport stream directly.

Start the client #

To start a client you need to choose a transport module and connect it to the desired endpoint. When the connection has been established you can start to negotiate a client session by calling the client.connect() method from the client instance. On success the client will return a session object.

If your transport disconnects the session will invalidate. If a reconnect is configured, the session will try to authenticate an revalidate the session again. All subscriptions and registrations will be recovered if possible.

final client = Client(
  realm: "my.realm",transport: WebSocketTransport("wss://localhost:8443")
);
final session = await client.connect();

RPC #

to work with RPCs you need to have an established session.

final client = Client(
  realm: "my.realm",new WebSocketTransport("wss://localhost:8443")
);
final session = await client.connect();

// Register a procedure
final registered = await session.register("my.procedure");
registered.onInvoke((invocation) {
  // to something with the invocation
})

// Call a procedure
await for (final result in session.call("my.procedure")) {
  // do something with the result
}

1.0.0-dev.4 #

  • more cleanup code to meet pana analysis requirements
  • added a working unit test for websocket transport in the vm

1.0.0-dev.3 #

  • more cleanup code to meet pana analysis requirements

1.0.0-dev.2 #

  • cleanup code to meet pana analysis requirements

1.0.0-dev.1 #

Use this package as a library

1. Depend on it

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


dependencies:
  connectanum: ^1.0.0-dev.4

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:connectanum/connectanum.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
41
Health:
Code health derived from static analysis. [more]
83
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
85
Overall:
Weighted score of the above. [more]
63
Learn more about scoring.

We analyzed this package on Jul 5, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13

Health suggestions

Fix lib/src/transport/socket/socket_helper.dart. (-2.96 points)

Analysis of lib/src/transport/socket/socket_helper.dart reported 6 hints, including:

line 20 col 3: Prefer using /// for doc comments.

line 25 col 3: Prefer using /// for doc comments.

line 32 col 3: Prefer using /// for doc comments.

line 50 col 3: Prefer using /// for doc comments.

line 125 col 55: Use = to separate a named parameter from its default value.

Fix lib/src/transport/socket/socket_transport.dart. (-2.96 points)

Analysis of lib/src/transport/socket/socket_transport.dart reported 6 hints, including:

line 23 col 3: Prefer using /// for doc comments.

line 42 col 11: Use = to separate a named parameter from its default value.

line 43 col 28: Use = to separate a named parameter from its default value.

line 50 col 3: Prefer using /// for doc comments.

line 276 col 7: DO use curly braces for all flow control structures.

Fix lib/src/message/event.dart. (-1.49 points)

Analysis of lib/src/message/event.dart reported 3 hints:

line 5 col 3: Prefer using /// for doc comments.

line 11 col 3: Prefer using /// for doc comments.

line 22 col 1: Prefer using /// for doc comments.

Fix additional 17 files with analysis or formatting issues. (-11.49 points)

Additional issues in the following files:

  • lib/src/serializer/json/serializer.dart (3 hints)
  • lib/src/message/abstract_message_with_payload.dart (2 hints)
  • lib/src/message/invocation.dart (2 hints)
  • lib/src/message/result.dart (2 hints)
  • lib/src/message/uri_pattern.dart (2 hints)
  • lib/src/protocol/session.dart (2 hints)
  • lib/src/authentication/ticket_authentication.dart (1 hint)
  • lib/src/client.dart (1 hint)
  • lib/src/message/call.dart (1 hint)
  • lib/src/message/challenge.dart (1 hint)
  • lib/src/message/published.dart (1 hint)
  • lib/src/message/registered.dart (1 hint)
  • lib/src/message/subscribed.dart (1 hint)
  • lib/src/transport/websocket/websocket_transport_html.dart (1 hint)
  • lib/src/transport/websocket/websocket_transport_io.dart (1 hint)
  • lib/src/transport/websocket/websocket_transport_none.dart (1 hint)
  • lib/src/authentication/scram/saslprep.dart (Run dartfmt to format lib/src/authentication/scram/saslprep.dart.)

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and connectanum.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is pre-release. (-5 points)

Pre-release versions should be used with caution; their API can change in breaking ways.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
logging ^0.11.4 0.11.4
pointycastle ^1.0.2 1.0.2
Dev dependencies
stream_channel 2.0.0
test ^1.12.0