{"size": 576, "ext": "js", "max_stars_repo_path": "lib/writers/devent-zmq.js", "max_stars_repo_name": "oi-jamesl/lil-brother", "max_stars_repo_stars_event_min_datetime": "2015-01-02T07:38:44.000Z", "max_stars_repo_stars_event_max_datetime": "2021-09-26T19:08:25.000Z", "max_issues_repo_path": "lib/writers/devent-zmq.js", "max_issues_repo_name": "oi-jamesl/lil-brother", "max_issues_repo_issues_event_min_datetime": "2017-11-20T16:10:26.000Z", "max_issues_repo_issues_event_max_datetime": "2020-05-26T22:21:10.000Z", "max_forks_repo_path": "lib/writers/devent-zmq.js", "max_forks_repo_name": "oi-jamesl/lil-brother", "max_forks_repo_forks_event_min_datetime": "2015-01-24T15:36:34.000Z", "max_forks_repo_forks_event_max_datetime": "2021-02-22T22:29:07.000Z"}
{"max_stars_count": 160, "max_issues_count": 2, "max_forks_count": 32, "avg_line_length": 20.5714285714, "max_line_length": 81, "alphanum_fraction": 0.6770833333}
var zmq = require('zmq');
var util = require('util');

var DeventZMQWriter = function(options) {

	events.EventEmitter.call(this);

	var uri = 'tcp://' + [options['devent-host'], options['devent-port']].join(':');

	this.socket = zmq.socket('push');
	this.socket.bindSync(uri);

	this.on('data', function(data) {

		this.socket.send(options['devent-topic'], zmq.ZMQ_SNDMORE);
		this.socket.send(JSON.stringify(data));
	});

	this.on('close', function() {
		this.socket.close();
	});
};

util.inherits(DeventZMQWriter, events.EventEmitter);

module.exports = DeventZMQWriter;

