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]
80
Health:
Code health derived from static analysis. [more]
61
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
39
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:stomp/stomp.dart.

Health suggestions

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

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

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

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

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

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

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

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

Analysis of lib/src/impl/util_read.dart reported 24 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 94 col 7: DO use curly braces for all flow control structures.

Fix lib/impl/plugin.dart. (-8.17 points)

Analysis of lib/impl/plugin.dart reported 17 hints, including:

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

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

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

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

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

Fix additional 5 files with analysis or formatting issues. (-14.14 points)

Additional issues in the following files:

  • lib/src/stomp_impl.dart (17 hints)
  • lib/src/impl/util_write.dart (4 hints)
  • lib/impl/plugin_vm.dart (3 hints)
  • lib/websocket.dart (3 hints)
  • lib/vm.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.

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.0.5
Transitive dependencies
matcher 0.12.5
meta 1.1.7
path 1.6.4
stack_trace 1.9.3
Dev dependencies
test any