Giter Club home page Giter Club logo

node-pachube-stream's People

Contributors

hookercookerman avatar

Stargazers

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

Watchers

 avatar  avatar

node-pachube-stream's Issues

Multiple subscribes on a single socket

Many thanks for publishing this extremely useful module :-)
Hope I'm not stretching this further than you intended.
I want to do a number of datastream subscribes and handle changes on any of them as they occur.
I can do this if each has its own connection. However, not on the same connection.

var http=require('http');
var hostname='api.pachube.com';
var key="my-key-here"; 
var Connection = require("pachube-stream").Connection;

// open connection
var conn = new Connection(key);
conn.on("error", function(error) {
    return console.log('connection error',error);
});

// handle subscribe acknowledgement
function complete (data) {
  console.log('subscribed to: ',data.resource);
}

// handle data arrival
function change (data) {
  value=data.body.current_value;
  when=data.body.at;
  what=data.resource;
  return console.log(when+': what='+what+': value='+value);
}

// the feeds - there will be many
var ds1 = conn.subscribe("/feeds/1539/datastreams/1");
ds1.on("complete", complete);
ds1.on("data", change);

// need to comment out these 3 lines to make one connection work
var ds2 = conn.subscribe("/feeds/1539/datastreams/2");
ds2.on("complete", complete);
ds2.on("data", change);

unless I comment out the above 3 lines I get this back this connection error:

{ stack: [Getter/Setter],
  arguments: [ 'emitEvent', undefined ],
  type: 'non_object_property_call',
  message: [Getter/Setter] }

Have looked at code but can't see why this is happening.
Is this a bug or am I misusing it?
paul at virtual-techno.com

Install from NPM

Richard,
The mod you made to allow this to subscribe to multiple streams has been working fine for many months.
However, I noticed that re-installing it on another platform did not work.
Just tried again, this time with a BeagleBone running Angstrom v2012.01-core - Kernel 3.2.5+ and the old problem reappeared.
Could you have forgotten to push it up to NPM?
Thx. Paul

Unsubscribe

I'm working on a version of my stuff that will resubscribe when pachube drops a subscription (possibly due to a server restart or whatever). I detect this with a watchdog timer as there is no other indication that this has happened.

I thought it best to unsubscribe everything and then resubscribe so I tried the unsubscribe function in this node module for the first time. It comes back on complete but I notice when testing that the unsubscribe has not taken place.

Looking at the code it seems that a new token is generated for the unsubscribe request. The pachube spec requires that the token be the one used to subscribe in the first place. The app has this and can pass it back in but it's ignored.

Paul

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.