Dart Force Framework

LOGO!

A realtime web framework for dart.

With this framework communication between client and server becomes easy, without any boilerplate code.

Introduction

Dart Force is a Realtime web framework for Dart. We will make it easy for you to create realtime applications with it in Dart, like a chat, interactive dashboard, multiplayer games, ...

How does it work?

Serverside

First of all you need a server to handle incoming messages and dispatch or handle this messages correctly.

import "package:force/force_serverside.dart";

ForceServer fs = new ForceServer();

main() {
  fs.server.use("/", (req, model) => "dartforcetodo");

  fs.start().then((_) {
    fs.on("add", (vme, sender) {
      fs.send("update", vme.json);
    });
  });
}
Clientside

The client can listen to messages:

ForceClient fc;
void main() {
  fc = new ForceClient();
  fc.connect();
  
  fc.onConnected.listen((e) {
    fc.on("update", (fme, sender) {
      querySelector("#list").appendHtml("<div>${fme.json["todo"]}</div>");
    });
  });
}

You can also send messages:

InputElement input = querySelector("#input");
var data = {"todo": input.value};
fc.send("add", data);

It is a little bit inspired by socket.io for the communication flow.

Dart Force mvc access

You have access to the force mvc webserver if you do the following:

forceServer.server.on(url, controllerHandler, method: 'GET');

Quick starter guide

This guide can help you to get you started! Getting started

Look at our wiki for more info or this info below.

Examples

You can find a lot of examples in the force examples organisation

Development trick

Following the next steps will make it easier for you to develop, this allows you to adapt clientside files and immidiatly see results without doing a pub build.

pub serve web --hostname 0.0.0.0 --port 7777 &&
export DART_PUB_SERVE="http://localhost:7777" &&
pub run bin/server.dart

Notes to Contributors

Fork Dart Force

If you'd like to contribute back to the core, you can fork this repository and send us a pull request, when it is ready.

If you are new to Git or GitHub, please read this guide first.

Twitter

Follow us on twitter https://twitter.com/usethedartforce

Google+

Follow us on google+

or join our G+ Community

Screencast tutorial

Screencast todo tutorial about the dart force realtime functionality on youtube

Join our discussion group

Google group

examples

Links to some examples that I made with this framework.

chat - source code

polymer example - source code

Libraries

dart_force_client_lib
dart_force_common_lib
dart_force_server_lib