making an api call through node js and retrieve the values

34 views
Skip to first unread message

pru...@gmail.com

unread,
Sep 26, 2014, 3:55:01 PM9/26/14
to nod...@googlegroups.com

i am working on simple node js module...
 a module that, when i give an ID and a request rate, returns a readable stream which emits location data for the corresponding satellite...
 i am trying to implement by using sub classing ReadableStream

 http://nodejs.org/api/stream.html#stream_class_stream_readable

 i am using this api

 http://wheretheiss.at/w/developer

providing my code below..

i am not sure how to include the api

http://jsfiddle.net/cc75cm3k/

function SimpleProtocol(source, options) {
  if (!(this instanceof SimpleProtocol))
    return new SimpleProtocol(source, options);

  Readable.call(this, options);
  this._inBody = false;
  this._sawFirstCr = false;

  // source is a readable stream, such as a socket or file
  this._source = source;

  var self = this;
  source.on('end', function() {
    self.push(null);
  });

  // give it a kick whenever the source is readable
  // read(0) will not consume any bytes
  source.on('readable', function() {
    self.read(0);
  });

  this._rawHeader = [];
  this.header = null;
}
Reply all
Reply to author
Forward
0 new messages