stomp_dart_client 0.1.6 copy "stomp_dart_client: ^0.1.6" to clipboard
stomp_dart_client: ^0.1.6 copied to clipboard

outdated

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/messaging',
    onConnect: onConnect,
    connectHeaders: {
      "Authorization": "Bearer yourToken"
    }
  )
);

void main() {
  stompClient.activate();
}
117
likes
0
pub points
97%
popularity

Publisher

verified publisherblackhorse-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

License

unknown (license)

Dependencies

meta, web_socket_channel

More

Packages that depend on stomp_dart_client