A Phoenix Channel implementation for Dart
Attempts to feature match the Javascript implementation found at phoenix.js
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 'package:phoenix_wings/phoenix_wings.dart';
final socket = new PhoenixSocket("ws://localhost:4000/websocket/socket");
// equivalent to passing connectionProvider: PhoenixIoConnection.provider
import 'package:phoenix_wings/html.dart';
final socket = new PhoenixSocket("ws://localhost:4000/websocket/socket", connectionProvider: PhoenixHtmlConnection.provider);
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();
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