force 0.7.1

  • readme.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 5

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

Changelog

This file contains highlights of what changes on each version of the force package.

Pub version 0.7.1

  • use the latest forcemvc

Pub version 0.7.0

  • upgrade packages in pubspec.yaml
  • use the latest forcemvc

Pub version 0.6.5+1

  • improve the test package of force

Pub version 0.6.5

  • adding more conditional logic when dispatching a protocol
  • add a test library so you can test your protocol flows better

Pub version 0.6.4

  • add your custom protocols on the force stack, providing an easy way to extends the management of websockets
  • Remove pingpong protocol (there is still a keepalive possibility on websockets)

Pub version 0.6.3+4

  • Fix a bug in view_collection.dart on the revert flow

Pub version 0.6.3+3

  • improve testing and code quality
  • update uuid to 0.5.0
  • fix issue with posting from IE9 to the polling server

Pub version 0.6.3+1 & 0.6.3+2

  • add the parsing of a Blob in a websocket that is been send by the server.
  • clean up on the long polling implementation
  • change the implementation of StreamSocket to work well with shelf_web_socket

Pub version 0.6.3

  • add onChange listener on viewCollection
  • change logic of keep alives to native keep alive implementation of a websocket

Pub version 0.6.2+2

  • add some logging about the keep alive

Pub version 0.6.2 & 0.6.2+1

  • keep a state of message when the client is offline, when it is back online we send these messages to the server
  • add a ping / pong protocol
  • add a keep alive timer, that send every x seconds ping signals to the clients

Pub version 0.6.1

  • add options possibility of cargo into the db client api of force
  • easier transform your clientside objects with serialize function
  • upgrade to forcemvc 0.7.0 and wired 0.4.3

Pub version 0.6.0

  • designing clientside db api
  • ForceClient: BC BREAK - port should be int instead of String
  • adding protocols wiring into force, having 2 clean api's next to eachother, db & communication api.
  • improvements on forceclient

Pub version 0.5.7

  • adapting the start method so it is compliant with the latest ForceMVC release! Future start({FallbackStart fallback})

Pub version 0.5.6+1

  • exporting underlying packages!

Pub version 0.5.6

  • Add 'reply' method to sender
  • It works in IE9
  • Upgrade to the latest ForceMVC implementations

Pub version 0.5.5

  • Server to server communication, based upon ServerSockets
  • Introducing connectors

Pub version 0.5.4

  • Prepare code for use on appengine

Pub version 0.5.3

  • Add new annotation @ClosedConnection and event stream for closedConnection
  • Add more documentation in the code

Pub version 0.5.2

fix dependencies on 'wired'

Pub version 0.5.1 & pub version 0.5.1+1

introduce @NewConnection send a message 'ack' to the new client on connection

Pub version 0.5.0+1

Improve internal working.

Pub version 0.5.0

Remove parentheses from annotations. Upgrade to latest forcemvc version (0.5.0+1). Expanding functionality for authentication with roles, like in forcemvc. Adding broadcast functionality

Pub version 0.4.2+1

Moving this framework to an organisation repo in github

Pub version 0.4.2

When a new Socket is been created a new SocketEvent will be added.

Pub version 0.4.1+1

Small changes in the Force class, renaming of the handle method.

Pub version 0.4.1

Making the force logic abstract, independent of the serverside http logic.

Pub version 0.4.0+2

Adding more tests for polling implementation, small improvements to the polling implementation.

Pub version 0.4.0 & 0.4.0+1

Make it possible to add @Autowired and @Value into the classes with @Receivable annotations.

Pub version 0.3.7

Making the setup of a project easier by creating a logging function.

Pub version 0.3.6

Add authentication rules into the framework.

Pub version 0.3.5

New structure! Look at the examples.

Pub version 0.3.4

Add host and port parameters to force client.

Pub version 0.3.3+10

Update dependency forcemvc.

Pub version 0.3.3+9

Improve the working of the polling mechanics into the right direction.

Pub version 0.3.3+8

Updating uuid package dependencies

Pub version 0.3.3+7

Adding option for static folder of force mvc, staticDir.

Pub version 0.3.3+6

Updating dependencies.

Pub version 0.3.3+5

Solving issue with startpage rendering!

Pub version 0.3.3+4

Updated this buildPath: '../build/web' to get it working in Dart 1.2

Pub version 0.3.3+2 & 0.3.3+3

Updating dependencies.

Pub version 0.3.3+1

Changing force_serveable with serve(name) with typing it with String.

Pub version 0.3.3

Introducing @Receivable so you can annotate a class that has receiver methods.

Pub version 0.3.2+4

Updating dependencies and force mirrors code.

Pub version 0.3.2+2

Solving the initialization of the client socket.

Pub version 0.3.2

Solving issue #12 and more toolable way to handle connecting. So now you need to implement onConnected and onDisconnected.

Pub version 0.3.1+3

You have access to the webserver through server property of the force server implementation.

Pub version 0.3.1+2

Update to the new force mvc package, update polling server code.

Pub version 0.3.1+1

Iterate over all the annotations at a method until you found the Receiver annotation.

Pub version 0.3.1

Extract webServer code and put it into forcemvc package

Pub version 0.3.0+5 & 0.3.0+6

Some small changes in logging and an update to the documentation.

Pub version 0.3.0+4

Adding a generateId method to the forceclient class. So you can use this unique id in the client to start something, for example a gamesession!

Pub version 0.3.0+3

Added an optional parameter url to forceclient so you can set the url to another hosted force server endpoint. Added an optional parameter heartbeat, to specify in milliseconds the heartbeat duration.

Pub version 0.3.0+2

Refactor the code so it uses a factory instead of a static method to choose the socket implementation clientside. Fixed an small issue when sending characters through polling and receiving it again.

Pub version 0.3.0+1

Sending the old property values in the profile changed event. So you can use the old value and look at the new value in profileInfo field.

Pub version 0.3.0

Adding socket abstraction to the dart force framework and add also the long polling mechanism as an alternative for websockets.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  force: ^0.7.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:force/force_browser.dart';
import 'package:force/force_common.dart';
import 'package:force/force_serverside.dart';
import 'package:force/test.dart';
  
Version Uploaded Documentation Archive
0.7.1 Jul 16, 2016 Go to the documentation of force 0.7.1 Download force 0.7.1 archive
0.7.0 Apr 14, 2016 Go to the documentation of force 0.7.0 Download force 0.7.0 archive
0.6.5+1 Jun 19, 2015 Go to the documentation of force 0.6.5+1 Download force 0.6.5+1 archive
0.6.5 Jun 7, 2015 Go to the documentation of force 0.6.5 Download force 0.6.5 archive
0.6.4 May 8, 2015 Go to the documentation of force 0.6.4 Download force 0.6.4 archive
0.6.3+4 Apr 24, 2015 Go to the documentation of force 0.6.3+4 Download force 0.6.3+4 archive
0.6.3+3 Apr 19, 2015 Go to the documentation of force 0.6.3+3 Download force 0.6.3+3 archive
0.6.3+2 Apr 13, 2015 Go to the documentation of force 0.6.3+2 Download force 0.6.3+2 archive
0.6.3+1 Apr 13, 2015 Go to the documentation of force 0.6.3+1 Download force 0.6.3+1 archive
0.6.3 Apr 6, 2015 Go to the documentation of force 0.6.3 Download force 0.6.3 archive

All 105 versions...

Popularity:
Describes how popular the package is relative to other packages. [more]
10
Health:
Code health derived from static analysis. [more]
0
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
0
Overall:
Weighted score of the above. [more]
5
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Support Dart 2 in pubspec.yaml.

The SDK constraint in pubspec.yaml doesn't allow the Dart 2.0.0 release. For information about upgrading it to be Dart 2 compatible, please see https://www.dartlang.org/dart-2#migration.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.9.0 <2.0.0