fixing socket API
This commit is contained in:
parent
76273d1c6c
commit
37d18b7b2d
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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 = [];
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue