How to use the amp.Stream function in amp

To help you get started, we’ve selected a few amp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gridcontrol / gridcontrol / src / network / socket-router.js View on Github external
function Actor(stream) {
  if (!(this instanceof Actor)) return new Actor(stream);
  this.parser = new amp.Stream;
  this.parser.on('data', this.onmessage.bind(this));
  stream.pipe(this.parser);
  this.stream = stream;
  this.callbacks = {};
  this.ids = 0;
  this.id = ++ids;
  Actor.emit('actor', this);
}
github gridcontrol / gridcontrol / src / network / secure-socket-router.js View on Github external
function Actor(stream) {
  if (!(this instanceof Actor)) return new Actor(stream);
  var that = this;
  this.parser = new amp.Stream;
  this.parser.on('data', this.onmessage.bind(this));
  stream.pipe(this.parser);
  this.stream = stream;
  this.callbacks = {};
  this.ids = 0;
  this.id = ++ids;
  this.secret_key = null;
  Actor.emit('actor', this);
}
github tj / node-actorify / index.js View on Github external
function Actor(stream) {
  if (!(this instanceof Actor)) return new Actor(stream);
  this.parser = new amp.Stream;
  this.parser.on('data', this.onmessage.bind(this));
  stream.pipe(this.parser);
  this.stream = stream;
  this.callbacks = {};
  this.ids = 0;
  this.id = ++ids;
  Actor.emit('actor', this);
}
github tj / axon / lib / sockets / sock.js View on Github external
Socket.prototype.addSocket = function(sock){
  var parser = new Parser;
  var i = this.socks.push(sock) - 1;
  debug('%s add socket %d', this.type, i);
  sock.pipe(parser);
  parser.on('data', this.onmessage(sock));
};

amp

Abstract messaging protocol

MIT
Latest version published 11 years ago

Package Health Score

67 / 100
Full package analysis

Popular amp functions