action_cable 0.1.5

  • Readme
  • Changelog
  • Installing
  • 78


ActionCable in Dart #

ActionCable is the default realtime websocket framework and protocol in Rails.

This is a dart port of the client and protocol implementation, which is available in web, dartVM and flutter.

Usage #

connect #

cable = ActionCable.Connect(
  headers: {
    'Authorization': 'Some Token',

  onConnected: (){

subscribe to channel #

  'Chat', // either 'Chat' and 'ChatChannel' is fine
  channelParams: { 'id': 1 },
  onSubscribed: (){}, // `confirm_subscription` received
  onMessage: (Map message) {} // any other message received

unsubscribe to channel #

  'Chat', // either 'Chat' and 'ChatChannel' is fine

perform action #

  'Chat', 'send',
  channelParams: { 'roomId': 1 },
  actionParams: { 'message': 'Hello' }

disconnect #


ActionCable protocol #

Anycable has a great doc on that topic.

# 2019-11-21 0.1.0

First version

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  action_cable: ^0.1.5

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:action_cable/action_cable.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Mar 30, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health issues and suggestions

Document public APIs. (-1 points)

12 out of 12 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/action_cable.dart. (-0.50 points)

Analysis of lib/action_cable.dart reported 1 hint:

line 23 col 32: Use = to separate a named parameter from its default value.

Format lib/channel_id.dart.

Run dartfmt to format lib/channel_id.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and action_cable.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
web_socket_channel ^1.1.0 1.1.0
Transitive dependencies
async 2.4.1
charcode 1.1.3
collection 1.14.12
convert 2.1.1
crypto 2.1.4
stream_channel 2.0.0
typed_data 1.1.6