Join 10350+ others. No spamming.
I promise!

Follow us at github.


ForceUniverse/dart-force

READ ME

VERSION!

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() async{
  fs.server.use("/", (req, model) => "dartforcetodo");
  await fs.start();

  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 (routing)

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

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

or just create a controller class. For more info go to the project page of force mvc

Shelf integration

You can very easily use the power of Force into the shelf stack by using shelf_web_socket package and then use the following code, so that force can interpret the websocket stream of shelf.

   Force force = new Force();
   var _handlerws = webSocketHandler((webSocket) => force.handle(new StreamSocket(webSocket)));

More info on the wiki page

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

Links to some examples that I made with this framework.

chat - source code

polymer example - source code

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

Server 2 Server

It is also possible to do server 2 server communication. You can find the more info here

or you can watch the video

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