Skip to content
forked from hacker-cb/stomp

STOMP Dart Client for communicating with STOMP-compliant messaging servers.

License

Notifications You must be signed in to change notification settings

KammererTob/stomp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

STOMP Dart Client for communicating with STOMP-compliant messaging servers.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 89.3%
  • Shell 6.0%
  • JavaScript 2.5%
  • sed 1.8%
  • HTML 0.4%