async_cable 1.2.2 copy "async_cable: ^1.2.2" to clipboard
async_cable: ^1.2.2 copied to clipboard

Async/stream-oriented implementation of the Rails ActionCable protocol for Dart & Flutter.

example/async_cable_example.dart

import 'package:async_cable/async_cable.dart';

String yourAuthToken() {
  return "your token goes here";
}

void main() async {
  final accessToken = yourAuthToken();
  final connection = await AsyncCable.connect(
    "ws://localhost:3000/cable",
    headers: {
      "Origin": "http://localhost:3000",
      "Authorization": "Bearer $accessToken",
    },
  );
  final channel = await connection.subscribe(
    "HelloChannel",
    {"foo": "bar"},
    (message) => print("Received ${message.message["greeting"]}"),
  );
  channel.perform("hello", {"greeting": "hi"});
}
2
likes
160
points
527
downloads

Publisher

verified publisherdelivereasy.co.nz

Weekly Downloads

Async/stream-oriented implementation of the Rails ActionCable protocol for Dart & Flutter.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

More

Packages that depend on async_cable