diff --git a/app/controllers/socket.js b/app/controllers/socket.js index e69a7348..b208d0dd 100644 --- a/app/controllers/socket.js +++ b/app/controllers/socket.js @@ -24,9 +24,10 @@ module.exports.broadcast_block = function(block) { }; module.exports.broadcast_address_tx = function(address, tx) { - ios.sockets.in(address).emit('tx', tx); + console.log('sending address tx '+address+' '+tx); + ios.sockets.in(address).emit('atx', tx); }; module.exports.broadcastSyncInfo = function(syncInfo) { - ios.sockets.emit('block', syncInfo); + ios.sockets.emit('status', syncInfo); }; diff --git a/public/js/controllers/transactions.js b/public/js/controllers/transactions.js index 33e0469d..ccb3a92b 100644 --- a/public/js/controllers/transactions.js +++ b/public/js/controllers/transactions.js @@ -9,7 +9,8 @@ angular.module('insight.transactions').controller('transactionsController', 'Transaction', 'TransactionsByBlock', 'TransactionsByAddress', - function ($scope, $rootScope, $routeParams, $location, Global, Transaction, TransactionsByBlock, TransactionsByAddress) { + 'get_socket', + function ($scope, $rootScope, $routeParams, $location, Global, Transaction, TransactionsByBlock, TransactionsByAddress, get_socket) { $scope.global = Global; $scope.findThis = function() { @@ -43,10 +44,12 @@ angular.module('insight.transactions').controller('transactionsController', $scope.txs = txs; }); }; - /*socket.on('tx', function(tx) { - console.log('Incoming message for new transaction!', tx); + var socket = get_socket($scope); + console.log('transactions.js'); + socket.on('atx', function(tx) { + console.log('Incoming transaction for address!', tx); $scope.findTx(tx.txid); - });*/ + }); $scope.txs = []; diff --git a/public/js/services/socket.js b/public/js/services/socket.js index 9ed679c3..98af5e1e 100644 --- a/public/js/services/socket.js +++ b/public/js/services/socket.js @@ -7,10 +7,8 @@ var ScopedSocket = function(socket, $rootScope) { }; ScopedSocket.prototype.removeAllListeners = function() { - console.log('remove all listeners'); for (var i = 0; i < this.listeners.length; i++) { var details = this.listeners[i]; - console.log('removing listener '+i); this.socket.removeListener(details.event, details.fn); } this.listeners = []; @@ -20,7 +18,6 @@ ScopedSocket.prototype.on = function(event, callback) { var socket = this.socket; var $rootScope = this.$rootScope; - var wrapped_callback = function() { var args = arguments; $rootScope.$apply(function() {