insight-ui-zcash/app/controllers/socket.js

24 lines
442 B
JavaScript
Raw Normal View History

2014-01-13 13:13:41 -08:00
'use strict';
// server-side socket behaviour
2014-01-14 11:56:02 -08:00
// io is a variable already taken in express
var ios = null;
2014-01-14 11:56:02 -08:00
module.exports.init = function(app, io_ext) {
ios = io_ext;
ios.set('log level', 1); // reduce logging
ios.sockets.on('connection', function() {
2014-01-13 13:13:41 -08:00
});
};
2014-01-14 11:56:02 -08:00
module.exports.broadcast_tx = function(tx) {
ios.sockets.emit('tx', tx);
2014-01-14 11:56:02 -08:00
};
2014-01-14 14:42:38 -08:00
module.exports.broadcast_block = function(block) {
ios.sockets.emit('block', block);
2014-01-14 14:42:38 -08:00
};