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

26 lines
455 B
JavaScript
Raw Normal View History

2014-01-13 13:13:41 -08:00
'use strict';
2014-01-16 12:25:52 -08:00
var Transaction = require('../models/Transaction');
2014-01-13 13:13:41 -08:00
// server-side socket behaviour
2014-01-14 11:56:02 -08:00
var io = null;
module.exports.init = function(app, io_ext) {
io = io_ext;
2014-01-13 13:13:41 -08:00
io.set('log level', 1); // reduce logging
io.sockets.on('connection', function(socket) {
2014-01-13 13:13:41 -08:00
});
};
2014-01-14 11:56:02 -08:00
module.exports.broadcast_tx = function(tx) {
io.sockets.emit('tx', tx);
};
2014-01-14 14:42:38 -08:00
module.exports.broadcast_block = function(block) {
io.sockets.emit('block', block);
};