entangle 0.1.2
entangle: ^0.1.2

Dart native
Flutter Android iOS

entangle is use Websocket web-server in dartVM. And you can use entangle-clien in Flutter.

example/example.dart

import 'package:entangle/entangle.dart';
import './example-client.dart';

class Context {
  String name = 'i am a context data';
}

void main() async {
  var entangle = Entangle({
    'hello-world': hello,
  }, context: Context());

  entangle.listen(port: 5000, path: '/ws');

  //simulation client
  clientApp();
}

// controller example
void hello(Context ctx, data, send) {
  send({'msg': '${data['msg']}-world', 'ctx-name': ctx.name});

  // if other == 100, send message at 1000ms ago
  if (data['other'] == 100) {
    Future.delayed(Duration(milliseconds: 1000), () {
      send({'other': 'server take the initiative at 1000ms ago'});
    });
  }
}
0
likes
80
pub points
0%
popularity

entangle is use Websocket web-server in dartVM. And you can use entangle-clien in Flutter.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

ymblender@gmail.com

License

BSD (LICENSE)

More

Packages that depend on entangle