stomp_dart_client 0.3.5

Dart native js
Flutter Android iOS web

Dart STOMP client for easy messaging interoperability. Build with flutter in mind, but should work for every dart application.

example/main.dart

import 'dart:async';
import 'dart:convert';

import 'package:stomp_dart_client/stomp.dart';
import 'package:stomp_dart_client/stomp_config.dart';
import 'package:stomp_dart_client/stomp_frame.dart';

dynamic onConnect(StompClient client, StompFrame frame) {
  client.subscribe(
      destination: '/topic/test/subscription',
      callback: (StompFrame frame) {
        List<dynamic> result = json.decode(frame.body);
        print(result);
      });

  Timer.periodic(Duration(seconds: 10), (_) {
    client.send(
        destination: '/app/test/endpoints', body: json.encode({'a': 123}));
  });
}

final stompClient = StompClient(
    config: StompConfig(
        url: 'ws://localhost:8080',
        onConnect: onConnect,
        onWebSocketError: (dynamic error) => print(error.toString()),
        stompConnectHeaders: {'Authorization': 'Bearer yourToken'},
        webSocketConnectHeaders: {'Authorization': 'Bearer yourToken'}));

void main() {
  stompClient.activate();
}
12
likes
110
pub points
85%
popularity

Publisher

blackhorse-one.com

Dart STOMP client for easy messaging interoperability. Build with flutter in mind, but should work for every dart application.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD (LICENSE)

Dependencies

meta, web_socket_channel

More

Packages that depend on stomp_dart_client