ucp_dart 1.0.0 copy "ucp_dart: ^1.0.0" to clipboard
ucp_dart: ^1.0.0 copied to clipboard

Universal Communication Protocol (UCP) for real-time MQTT-based device communication in Dart.

example/main.dart

import 'package:ucp_dart/ucp_dart.dart';

void main() async {
  final client = UCPClient(
    brokerAddress: 'broker.emqx.io',
    deviceId: 'example-device',
  );

  await client.connect();

  client.subscribe('ucl/commands/example-device');

  client.setMessageHandler((topic, message) {
    print('Received on $topic: $message');
    if (message == '{"action": "ping"}') {
      client.publish('ucl/status/example-device', '{"status": "pong"}');
    }
  });

  client.publish('ucl/status/example-device', '{"status": "online"}');
}
0
likes
0
points
23
downloads

Publisher

unverified uploader

Weekly Downloads

Universal Communication Protocol (UCP) for real-time MQTT-based device communication in Dart.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

mockito, mqtt_client

More

Packages that depend on ucp_dart