Git Product home page Git Product logo

arcusnode's Introduction

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 [[email protected]]
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:

  • P2P Rendezvouz service
  • NetGroups
  • Remote Methods / Commands
  • Authentication
  • Plugins

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:

  • start
  • stop
  • handshake
  • connect
  • disconnect
  • command

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:

  • Add testing scripts and a Flash testing project
  • Complete AMF reading/writing (70%)

Development

If you have ideas, suggestions, bugfixes or just want to yell a little at the author, feel free to contact [email protected]

© Copyright 2011 OpenRTMFP

arcusnode's People

Contributors

arcusdev avatar eden avatar kommander avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arcusnode's Issues

Socket message handler error: TypeError: Cannot set property '1' of undefined

error [Tue Sep 20 2011 05:02:01 GMT+0000 (UTC)]  Socket message handler error: TypeError: Cannot set property '1' of undefined
at /home/matt/arcus/ArcusNode/lib/arcus_node.js:534:30
at /home/matt/arcus/ArcusNode/lib/arcus_node.js:245:7
at Socket.<anonymous> (/home/matt/arcus/ArcusNode/lib/arcus_node.js:867:9)
at Socket.emit (events.js:70:17)
at UDP.onMessage [as onmessage] (dgram_uv.js:307:10)
02 58 65 0C 02 F4 8D 40 5F 4A B4 10 00 2D 80 03 .Xe....._J...-..
01 01 05 00 54 43 04 02 00 11 09 D0 D6 73 00 02 ....TC.......s..
00 04 70 6C 61 79 00 00 00 00 00 00 00 00 00 05 ..play..........
02 00 08 6D 79 73 74 72 65 61 6D FF FF FF FF FF ...mystream.....
FF FF FF FF                                     ....

Permanent connection doesnt work

Hey,

if i change the settings like this:
settings.manageInterval = 24 * 60 * 60;
settings.connectionTimeout = (24 * 60 * 60)*1000;
settings.clientKeepalive = 1000;
settings.serverKeepalive = 1000;
settings.maxKeepalives = 30000;

i still get a timeout in like 2minutes.

anyone knows how i can change the settings to like 24h ?

Full script:
http://pastebin.com/b4yf3AcK

很好

不错啊 很喜欢这个

node 0.5.7 - Socket message handler error: Error: Invalid arguments for Packet

error [Sat Sep 17 2011 17:18:55 GMT+0000 (UTC)]  Socket message handler error: Error: Invalid arguments for Packet
at new <anonymous> (/home/matt/arcus/ArcusNode/lib/packet.js:48:11)
at /home/matt/arcus/ArcusNode/lib/arcus_node.js:212:15
at Socket.<anonymous> (/home/matt/arcus/ArcusNode/lib/arcus_node.js:867:9)
at Socket.emit (events.js:70:17)
at UDP.onMessage [as onmessage] (dgram_uv.js:307:10) 
11 85 F4 CB 0C 99 24 16 1D 1C D0 DD BD CB 74 60 ..............t.
B2 A0 5B 3D 01 2F 8B 72 79 E0 E8 3B 6B A3 0E 10 ...../.ry...k...
0E A4 15 B1 38 7A DE B9 90 B6 99 FB 07 5B 64 3C ....8z........d.
64 43 31 6B B1 67 26 E8 93 30 CD 8C 1F 54 77 1D dC1k.g...0...Tw.
48 DA EA 6E                                     H..n

How about RTMP relaying to RTMFP?

Adobe Media Flash Live Encoder supports RTMP only, and a RTMFP publisher peer might be behind an NAT which blocks the P2P connection to the publisher peer. If ArcusNode can accept RTMP stream and republishes the stream to RTMFP stream, that will really good.

OS X Lion installation

Problem description

After installing ArcusNode on Mac OS X Lion system, it won't run and raise following error:

$ node service.js 
module.js:485
  process.dlopen(filename, module.exports);
          ^
Error: dlopen(/Users/ignatev/Documents/Coding/OpenSource/ArcusNode/ArcusNode/build/Release/rtmfp.node, 1): no suitable image found.  Did find:
    /Users/ignatev/Documents/Coding/OpenSource/ArcusNode/ArcusNode/build/Release/rtmfp.node: mach-o, but wrong architecture
    at Object.Module._extensions..node (module.js:485:11)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/Users/ignatev/Documents/Coding/OpenSource/ArcusNode/ArcusNode/lib/packet.js:20:13)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

How to reproduce

  1. Install nodejs 0.8.8 from sources (configure --prefix=/usr/local/bin to prevent "Checking for node prefix: not found" during building of ArcusNode).
  2. Install node-waf 1.5.16 from sources too.
  3. Download ArcusNode and run node-waf configure build:
$ node-waf configure build
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : ok /usr/local/bin 
Checking for node prefix                 : ok /usr/local 
'configure' finished successfully (0.048s)
Waf: Entering directory `/Users/ignatev/Documents/Coding/OpenSource/ArcusNode/ArcusNode/build'
Waf: Leaving directory `/Users/ignatev/Documents/Coding/OpenSource/ArcusNode/ArcusNode/build'
'build' finished successfully (0.015s)

ReferenceError: _sendResponse is not defined

When trying to register a custom command I get this error:

ReferenceError: _sendResponse is not defined
at [object Object].commandResult (/var/www/node/ArcusNode/lib/arcus_node.js:676:5)
at Array.0 (/var/www/node/ArcusNode/lib/arcus_node.js:442:21)
at EventEmitter._tickCallback (node.js:192:40)

Socket message handler error: Error: Invalid hex string

I wish I could provide more information as to what caused this but hopefully you have a better idea than I do:

error [Mon Sep 12 2011 18:43:17 GMT+0000 (UTC)]  Socket message handler error: Error: Invalid hex string
    at SlowBuffer.hexWrite (buffer.js:115:11)
    at Buffer.write (buffer.js:343:25)
    at new Buffer (buffer.js:252:26)
    at ipv6ToBytes (/home/matt/arcus/ArcusNode/lib/rtmfp.js:1024:12)
    at [object Object].readAddress (/home/matt/arcus/ArcusNode/lib/rtmfp.js:1036:26)
    at [object Object].readMessage (/home/matt/arcus/ArcusNode/lib/rtmfp.js:403:45)
    at [object Object].readPacket (/home/matt/arcus/ArcusNode/lib/rtmfp.js:84:22)
    at /home/matt/arcus/ArcusNode/lib/arcus_node.js:243:30
    at Socket.<anonymous> (/home/matt/arcus/ArcusNode/lib/arcus_node.js:867:9)
    at Socket.emit (events.js:70:17)
D8 47 0E 0D DC 1D 8D 92 E8 0A 16 10 00 63 00 02 .G...........c..
03 01 11 00 00 1C 4F 00 02 00 0B 73 65 74 50 65 ......O....setPe
65 72 49 6E 66 6F 00 00 00 00 00 00 00 00 00 05 erInfo..........
02 00 11 31 39 32 2E 31 36 38 2E 31 2E 32 3A 35 ...192.168.1.2:5
35 31 31 38 02 00 2A 5B 32 30 30 31 3A 30 3A 35 5118....2001:0:5
65 66 35 3A 37 39 66 64 3A 33 65 3A 33 62 65 35 ef5:79fd:3e:3be5
3A 61 30 37 62 3A 37 36 39 33 5D 3A 35 35 31 31 :a07b:7693.:5511
39 FF FF FF                                     9...

Manage cycle error: TypeError: Cannot read property 'touched' of undefined

Using latest from git, not sure what's causing this:

/home/matt/arcus/ArcusNode/lib/arcus_node.js:799
if(nc.state != NetConnection.CLOSING) {
         ^
TypeError: Cannot read property 'state' of undefined
at /home/matt/arcus/ArcusNode/lib/arcus_node.js:799:10
at /home/matt/arcus/ArcusNode/lib/arcus_node.js:896:7
at [object Object].forEach (/home/matt/arcus/ArcusNode/lib/map.js:92:8)
at [object Object].stop (/home/matt/arcus/ArcusNode/lib/arcus_node.js:895:21)
at EventEmitter.<anonymous> (/home/matt/node/cam.js:131:7)
at EventEmitter.emit (events.js:64:17)
at SignalWatcher.callback (node.js:320:45)


error [Tue Sep 13 2011 19:49:41 GMT+0000 (UTC)]  Manage cycle error: TypeError: Cannot read property 'touched' of undefined
at /home/matt/arcus/ArcusNode/lib/arcus_node.js:109:21
at [object Object].forEach (/home/matt/arcus/ArcusNode/lib/map.js:92:8)
at Timer.callback (/home/matt/arcus/ArcusNode/lib/arcus_node.js:107:23)

Error: Cannot find module '../build/Release/rtmfp.node'

My version of node is:
v0.9.4-pre

ArcadusNode version is the one just downloaded today.

root@phcdevel:~/ArcusNode-master# node-waf configure build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : ok /usr/local/lib/node_modules/
Checking for node prefix : ok /usr/local
'configure' finished successfully (0.014s)
Waf: Entering directory /root/ArcusNode-master/build' Waf: Leaving directory/root/ArcusNode-master/build'
'build' finished successfully (0.004s)

root@phcdevel:~/ArcusNode-master# node service.js

module.js:340
throw err;
^
Error: Cannot find module '../build/Release/rtmfp.node'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object. (/root/ArcusNode-master/lib/packet.js:20:13)
at Module._compile (module.js:454:26)
at Object.Module._extensions..js (module.js:472:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)

push messages from ArcusNode to Flash client

Hello! Is it possible to send a text message / command from server to a client? In such a way that it'll be processed by NetConnection event handlers or by NetGroup.

Seems like for now it's only possible to respond to client's command. What I'm trying to do is RTMFP chat with chat rooms. Obviously ability to push data would be very helpful.

Cumulus seems to be able to push a message. However as far as I understand they do it as raw AMF message which likely to be ignored by NetConnection API, is it true?

The best would be of course to be able to send message to a NetGroup.

Best
Denis

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.