tx info sent to homepage.

This commit is contained in:
Manuel Araoz 2014-01-13 19:07:12 -03:00
parent 2e959fa81c
commit ada63f8488
3 changed files with 4 additions and 10 deletions

View File

@ -3,9 +3,3 @@ extends layouts/default
block content
section.container(data-ng-view)
div.row
div.span4
Test
div.span4
Test2

View File

@ -5,9 +5,8 @@ var Transaction = require('../../models/Transaction');
module.exports = function(app, io) {
io.set('log level', 1); // reduce logging
io.sockets.on('connection', function(socket) {
socket.emit('tx', Transaction.findOne());
socket.on('my other event', function(data) {
console.log(data);
Transaction.findOne(function(err, tx) {
socket.emit('tx', tx);
});
});
};

View File

@ -8,7 +8,8 @@ angular.module('mystery.system').controller('IndexController', ['$scope', 'Globa
$(document).ready(function() {
var socket = io.connect('http://localhost');
socket.on('tx', function(data) {
console.log(data);
var tx = data;
console.log('Transaction received! '+tx.txid);
});
});