switchboard 2.0.11

  • Readme
  • Changelog
  • Installing
  • 29

Switchboard #

Microservice communication protocol.

Frames #

The base connection is any framed messaging protocol. The current WSTalk2 protocol target is WebSockets since it's ubiquitously available everywhere.

Channels #

The message frame connection is multiplexed into channels for arbitrary usage. Both sides of the connection can arbitrarily open new channels. When opening a channel, an arbitrary payload blob is included for the application to interpret and process. The payload can be used for authentication, identification, and addressing purposes.

These multiplexed channels are effectively a framed messaging protocol, and technically can be recursively multiplexed into more channels.

An entire channel can be transparantly proxied to another host without parsing it's contents.

Message Chain #

The message chain protocol is defined to run on top of any framed messaging protocol. This is similar to an RPC protocol, but rather than being purely request-response, each message can be a response to a previous message, and multiple messages can be sent as a response to form a streamed response. The message chain can recursively respond with streams to individual stream responses, and so on.

An entire message chain starting from any message can be transparantly proxied to another host without parsing it's contents.

Usage #

Future Plans #

Redesign to target both QUIC and WebSockets as primary transport layers.

2.0.6 #

  • Don't reset payload if identical.

2.0.5 #

  • Fix issue reconnecting after previous error.

2.0.4 #

  • Rebranding
  • Rewrite from scratch with simplified interface.
  • Support channels for allowing virtual services or protocols on the same host (virtual hosts, etc.)

1.3.3 #

  • Can now request for streams. Stream responses can recursively be requests as well.

1.2.1 #

  • Request messages can be replied to with an exception using sendException.
  • Request message timeout can be extended through the sendExtend function.
  • Formatted source.
  • Fixed some minor issues.

0.9.3 #

  • Initial version.

Use this package as a library

1. Depend on it

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

  switchboard: ^2.0.11

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

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

  • Dart: 2.7.1
  • pana: 0.13.6

Health suggestions

Fix lib/src/talk_channel.dart. (-15.25 points)

Analysis of lib/src/talk_channel.dart reported 33 hints, including:

line 69 col 30: Unnecessary new keyword.

line 81 col 7: Unnecessary new keyword.

line 85 col 7: Unnecessary new keyword.

line 89 col 7: Unnecessary new keyword.

line 93 col 7: Unnecessary new keyword.

Fix lib/src/switchboard.dart. (-11.78 points)

Analysis of lib/src/switchboard.dart reported 25 hints, including:

line 171 col 10: The value of the field '_discoveryService' isn't used.

line 194 col 31: Use = to separate a named parameter from its default value.

line 218 col 60: Use = to separate a named parameter from its default value.

line 239 col 65: Use = to separate a named parameter from its default value.

line 252 col 11: DO use curly braces for all flow control structures.

Fix lib/src/mux_channel_impl.dart. (-1 points)

Analysis of lib/src/mux_channel_impl.dart reported 2 hints:

line 16 col 30: Unnecessary new keyword.

line 22 col 7: Unnecessary new keyword.

Fix lib/src/rewindable_timer.dart. (-1 points)

Analysis of lib/src/rewindable_timer.dart reported 2 hints:

line 18 col 14: Unnecessary new keyword.

line 24 col 16: Unnecessary new keyword.

Format lib/src/mux_connection_impl.dart.

Run dartfmt to format lib/src/mux_connection_impl.dart.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (synchronized).

Package is getting outdated. (-28.49 points)

The package was last published 67 weeks ago.

The package description is too short. (-17 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

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 switchboard.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.58.0 <3.0.0
logging ^0.11.3+2 0.11.4
meta ^1.1.5 1.1.8
synchronized ^1.5.3 1.5.3+2 2.2.0
Dev dependencies
async ^2.0.8
test ^1.0.0