Skip to main content

hibira 0.1.1 copy "hibira: ^0.1.1" to clipboard
hibira: ^0.1.1 copied to clipboard

Pusher Channels protocol client in pure Dart for Hibira and other Pusher-compatible servers. Public, private, presence, encrypted and server-to-user channels on Flutter, the web and the Dart VM.

example/main.dart

// Listens on a public channel and prints its events.
//
//   dart run example/main.dart <app key> [channel]
import 'dart:io';

import 'package:hibira/hibira.dart';

Future<void> main(List<String> args) async {
  if (args.isEmpty) {
    stderr.writeln('usage: dart run example/main.dart <app key> [channel]');
    exit(64);
  }
  final hibira = HibiraClient(args[0]);
  hibira.stateChanges.listen((s) => print('connection: ${s.name}'));
  await hibira.connect();
  print('socket id: ${hibira.socketId}');

  final channel = hibira.subscribe(args.length > 1 ? args[1] : 'my-channel');
  await channel.whenSubscribed;
  print('subscribed to ${channel.name}; publish an event from the portal');
  channel.events.listen((e) => print('${e.name}: ${e.data}'));

  await ProcessSignal.sigint.watch().first;
  await hibira.dispose();
}
0
likes
150
points
841
downloads

Documentation

API reference

Publisher

verified publisherhibira.io

Weekly Downloads

Pusher Channels protocol client in pure Dart for Hibira and other Pusher-compatible servers. Public, private, presence, encrypted and server-to-user channels on Flutter, the web and the Dart VM.

Homepage
Repository (GitHub)
View/report issues

Topics

#websocket #realtime #pusher #presence #chat

License

MIT (license)

Dependencies

http, pinenacl, web_socket_channel

More

Packages that depend on hibira