web3mq_websocket 0.1.0-dev.1 copy "web3mq_websocket: ^0.1.0-dev.1" to clipboard
web3mq_websocket: ^0.1.0-dev.1 copied to clipboard

A lightware websocket tool to communicate with web3mq.

example/web3mq_websocket_example.dart

import 'dart:typed_data';

import 'package:web3mq_core/models.dart';
import 'package:web3mq_websocket/src/websocket.dart';

void main() async {
  final websocket = Web3MQWebSocketManager(baseUrl: 'endpoint');

  // lisnten the new message stream.
  websocket.messageStream.listen((event) {});

  // lisnten the new notification stream.
  websocket.notificationStream.listen((event) {});

  // lisnten the connection status stream.
  websocket.connectionStatusStream.listen((event) {});

  /// listen the sending status stream.
  websocket.messageUpdateStream.listen((event) {});

  // replace with your own user
  final user = User('userId', DID('type', 'value'), Uint8List.fromList([]));
  await websocket.connect(user);
  websocket.sendText('text', 'topic');
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A lightware websocket tool to communicate with web3mq.

Homepage

License

unknown (LICENSE)

Dependencies

collection, convert, cryptography, equatable, fixnum, logging, pointycastle, protobuf, rxdart, uuid, web3mq_core, web_socket_channel

More

Packages that depend on web3mq_websocket