stomp 0.8.0

STOMP Dart Client #

STOMP Dart client for communicating with STOMP complaint messaging brokers and servers.

Stomp Dart Client is distributed under an Apache 2.0 License.

Build Status

See also Ripple - Lightweight Dart Messaging Server.

Installation #

Add this to your pubspec.yaml (or create it):

dependencies:
  stomp:

Then run the Pub Package Manager (comes with the Dart SDK):

pub install

Usage #

Running on Dart VM #

import "package:stomp/stomp.dart";
import "package:stomp/vm.dart" show connect;

void main() {
  connect("foo.server.com").then((StompClient client) {
    client.subscribeString("/foo",
      (Map<String, String> headers, String message) {
        print("Recieve $message");
      });

    client.sendString("/foo", "Hi, Stomp");
  });
}

There are basically a few alternative ways to communicate:

  • JSON objects: sendJson() and subscribeJson()
  • Strings: sendString() and subscribeString()
  • Bytes: sendBytes() and subscribeBytes()
  • BLOB (huge data): sendBlob() and subscribeBlob()

Please refer to StompClient for more information.

Running on Browser #

The same as the above, except import websocket.dart instead of vm.dart:

import "package:stomp/stomp.dart";
import "package:stomp/websocket.dart" show connect;

//the rest is the same as running on Dart VM

Limitations #

  • Support STOMP 1.2 or above
  • Support UTF-8 encoding

Incompleteness #

  • Heart beat not supported.

Use this package as a library

1. Depend on it

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


dependencies:
  stomp: ^0.8.0

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

We analyzed this package on Apr 4, 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/stomp_impl.dart. (-18.17 points)

Analysis of lib/src/stomp_impl.dart reported 40 hints, including:

line 27 col 12: Unnecessary new keyword.

line 36 col 12: Unnecessary new keyword.

line 59 col 49: Unnecessary new keyword.

line 62 col 51: Unnecessary new keyword.

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

Fix lib/stomp.dart. (-17.34 points)

Analysis of lib/stomp.dart reported 38 hints, including:

line 24 col 18: Avoid const keyword.

line 25 col 20: Avoid const keyword.

line 26 col 31: Avoid const keyword.

line 38 col 23: Avoid const keyword.

line 41 col 22: Avoid const keyword.

Fix lib/src/impl/util_read.dart. (-14.39 points)

Analysis of lib/src/impl/util_read.dart reported 31 hints, including:

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

line 39 col 9: DO use curly braces for all flow control structures.

line 41 col 22: Avoid empty catch blocks.

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

line 76 col 18: Unnecessary new keyword.

Fix additional 6 files with analysis or formatting issues. (-21.33 points)

Additional issues in the following files:

  • lib/impl/plugin.dart (22 hints)
  • lib/websocket.dart (7 hints)
  • lib/src/impl/util_write.dart (6 hints)
  • lib/impl/plugin_vm.dart (4 hints)
  • lib/vm.dart (3 hints)
  • lib/src/stomp_util.dart (2 hints)

Maintenance issues and suggestions

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

Use constrained dependencies. (-20 points)

The pubspec.yaml contains 1 dependency without version constraints. Specify version ranges for the following dependencies: quiver.

Package is getting outdated. (-41.10 points)

The package was last published 73 weeks ago.

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

For more information see the pub package layout conventions.

The package description is too short. (-6 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.

Documentation URL is insecure. (-5 points)

Update the documentation field and use a secure (https) URL.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
quiver any 2.1.3
Transitive dependencies
matcher 0.12.6
meta 1.1.8
path 1.6.4
stack_trace 1.9.3
Dev dependencies
test any