node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

node-ralf

Node RaLF Server

This is an experimental implementation of a node.js server for the Energistics RLF protocol, for streaming real-time data from oil field facilities. It uses websockets for transport and Apache Avro for serialization.

Prerequisites

  • Install Node from nodejs.org - v0.10 min required.
  • Clone the node folder from mercurial. Say, into c:\sf\rlfprototype-code-0\src\Node

Installation

c:\>mkdir ralfdemo

c:\>cd ralfdemo

c:\ralfdemo>npm install d:\sf\rlfprototype-code-0\src\Node

Various junk like this will show up as Node trys to install dependencies

npm http GET https://registry.npmjs.org/node-uuid
npm http GET https://registry.npmjs.org/websocket
npm http GET https://registry.npmjs.org/simple-http-server
npm http 304 https://registry.npmjs.org/node-uuid
npm http 304 https://registry.npmjs.org/websocket
npm http 304 https://registry.npmjs.org/simple-http-server
npm WARN engine simple-http-server@0.1.8: wanted: {"node":"0.6.x","npm":"1.1.x"} (current: {"node":"v0.10.2","npm":"1.2.15"})
npm http GET https://registry.npmjs.org/colors
npm http GET https://registry.npmjs.org/optimist
npm http GET https://registry.npmjs.org/openurl

> websocket@1.0.8 install D:\ralfdemo\node_modules\node-ralf\node_modules\websocket
> node install.js

This step may fail, if you do not have a compiler configured and on your path. Not to worry, the code still runs, just not quite as efficiently.

[websocket v1.0.8] Attempting to compile native extensions.
npm http 304 https://registry.npmjs.org/openurl
npm http 304 https://registry.npmjs.org/optimist
npm http 304 https://registry.npmjs.org/colors
npm http GET https://registry.npmjs.org/wordwrap
npm http 304 https://registry.npmjs.org/wordwrap
[websocket v1.0.8] Native extension compilation successful!
node-ralf@0.0.1 node_modules\node-ralf
├── node-uuid@1.4.0
├── simple-http-server@0.1.8 (openurl@1.1.0, colors@0.6.0-1, optimist@0.3.7)
└── websocket@1.0.8

Running

D:\ralfdemo>node bin/server	
Unzipped sample data

simple-http-server Now Serving: ./ at http://localhost:8080/

Wed May 08 2013 08:05:21 GMT-0500 (Central Daylight Time) RaLF Server is listening on port 8081

Options

The following can be passed as command line options when starting the server.

Option Default Description
--httpServer true Run the web server, set false if you just want the RaLF Websocket server
--httpPort=port 8080 Webserver Port
--wsPort=port 8081 Websocket Port
--schemas lastest Name of the RaLF schema file to use. Look in the schema folder for .avpr files, any can be used
--autoSubscribe false Start pushing data without a subscription
--defaultSubscription Name of a Uri to use when auto-publishing, must correspond to a .json file in the data directory.