Node JS Examples

From Open Rail Data Wiki
Revision as of 17:55, 9 July 2013 by Jonathon Hurley (talk | contribs) (Created new Node.js examples page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Remember to enable the feed you are trying to subscribe in the network rail web application.

var prettyjson = require('prettyjson'),
    StompClient = require('stomp-client').StompClient;

var destination = '/topic/TRAIN_MVT_ALL_TOC',
    client = new StompClient('', 61618, 'emailaddress', 'your_password', '1.0');

client.connect(function(sessionId) {
    console.log('Trying to connect...');
    client.subscribe(destination, function(body, headers) {