Skip to content

5l1v3r1/phoenix_wings

 
 

Repository files navigation

Build Status

Pub

phoenix_wings.dart

A Phoenix Channel implementation for Dart

Attempts to feature match the Javascript implementation found at phoenix.js

Usage

API Documentation

Much of the library is the same whether your code is running in the VM/Flutter or in a browser. Due to differences between the two platforms, the connection setup differs slightly.

Import & Connection (VM/Flutter)

import 'package:phoenix_wings/phoenix_wings.dart';


final socket = new PhoenixSocket("ws://localhost:4000/websocket/socket");

// equivalent to passing connectionProvider: PhoenixIoConnection.provider

Import & Connection (HTML)

import 'package:phoenix_wings/html.dart';


final socket = new PhoenixSocket("ws://localhost:4000/websocket/socket", connectionProvider: PhoenixHtmlConnection.provider);

Common Usage

await socket.connect();

final chatChannel = socket.channel("room:chat", {"id": "myId"});

chatChannel.on("user_entered", PhoenixMessageCallback (Map payload, String _ref, String, _joinRef) {
    print(payload);
});

chatChannel.join();

Testing

Most of the tests are run on the VM. However, the PhoenixHtmlConnection tests must run in a browser.

By default tests will run on VM, Chrome and Firefox. This is set in dart_test.yaml

Tests are run via pub run test

About

Phoenix Channels client for Dart / Flutter

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Dart 67.8%
  • Elixir 24.1%
  • JavaScript 4.6%
  • HTML 2.2%
  • Objective-C 0.8%
  • Java 0.4%
  • CSS 0.1%