OpenRTMFP / ArcusNode

A RTMFP Rendevouz Service For Peer Assisted Networking With Adobe Flash on Node JS
GNU General Public License v3.0
175 stars 36 forks source link

ArcusNode

A RTMFP Rendevouz Server For Peer Assisted Networking With Adobe Flash on NodeJS

ArcusNode aims to assist P2P networking with ease of extendability due to Javascript glue with NodeJS. ArcusNode is a standalone RTMFP implementation. We want to thank Cumulus, a standalone C++ implementation of the RTMFP Protocol and much more.

Author: arcusdev [arcus.node@gmail.com]
License: GPL

Issues

If you have an issue with ArcusNode, please use the Github issue tracker!

Status

ArcusNode is still under heavy development and much work remains to be done. It covers the following features already:

Build & Installation

ArcusNode runs on Node v0.5.5 and higher. To use ArcusNode as a service, get it from github and run:

$> node-waf configure build
$> node service.js

You then should see something like:

Starting up ArcusNode RTMFP Service.
Copyright (C) 2011 OpenRTMFP
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions.
(For usage help type "node service.js -h")
ArcusNode RTMFP Service running at 0.0.0.0:1935

1935 is the default port for RTMFP communication and you should now be able to connect to the server, create groups and get peers connected.

Cygwin

If you run into problems building node on Cygwin, checkout https://github.com/joyent/node/wiki/Building-node.js-on-Cygwin-(Windows). If you consider using rebase, use both ./rebaseall and ./perlrebase.

Usage

Basic

As you can see in the service.js, it is very easy to use ArcusNode in your own project.

var ArcusNode = require('./lib/arcus_node.js');
var arcusService = new ArcusNode();
arcusService.run();

Customization

ArcusNode uses a mixture of Events and registered command callbacks. Events behave like known Node core events. Commands are called by a connected client through its NetConnection#call and can be registered on ArcusNode. Commands on the server behave almost exactly the same as described in the Flash Documentation, except that ArcusNode command callbacks always get the NetConnection which called the command as first argument, then the arguments from the Client.

Events

At this moment, ArcusNode emits the following events:

ArcusNode uses the Node EventEmitter API

Example for a connect event listener:

var ArcusNode = require('./lib/arcus_node.js');
var arcusService = new ArcusNode();

arcusService.on('connect', function(nc, obj){
  console.log('Received a connection request for Connection ' + nc.id + ' with the properties', obj);
});

arcusService.run();

Commands

[todo]

Example for a command Client side:

var responder:Responder = new Responder(function(response) {
  trace(response.what); //-> 'ArcusNode rocks!'
});
connection.call('sayWhat', responder, { name: 'ArcusNode' });

Example for a command Server side:

arcusService.onCommand('sayWhat', function(nc, obj){
  return { what: obj.name + ' rocks!' };
});

ArcusNode Settings

The ArcusNode constructor takes a settings object with the following attributes:

.port
  Type: Integer
  Default: 1935
  The port that ArcusNode will listen for UDP connections.

.address
  Type: String
  Default: ''
  ArcusNode can be run on a specific interface if wanted.

.logLevel
  Type: String
  Default: 'warn'
  Can be one of ['fatal', 'error', 'warn', 'info', 'debug'].

.logFile:
  Type: String, path
  Default: ''
  If a path for a log file is specified, all logging will be written to that file.

.manageInterval 
  Type: Integer, seconds 
  default: 60 
  The interval for the management cycle to do cleanup

.connectionTimeout 
  Type: Integer, milliseconds 
  Default: 120000 
  The timeout for a NetConnection. The connections is dropped after the NetConnection was unused for that amount of time. 

.groupTimeout
  Type: Integer, milliseconds
  Default: 360000
  The timeout for a NetGroup. The group is dropped afer there was no interaction for that amount of time.

.serverKeepalive
  Type: Integer, milliseconds
  Default: 60000
  The timeout before the server sends a keepalive command to the client.
  Should be less then connectionTimeout.

.clientKeepalive
  Type: Integer, milliseconds
  Default: 60000
  Will tell the client in what interval it should send keepalive messages

.maxKeepalives
  Type: Integer
  Default: 3
  How often to max keepalive the connection before dropping it.

Roadmap

To reach version 0.1:

Development

If you have ideas, suggestions, bugfixes or just want to yell a little at the author, feel free to contact arcus.node@gmail.com

© Copyright 2011 OpenRTMFP