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) {
|
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) {
|
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',
|
'Transaction',
|
||||||
'TransactionsByBlock',
|
'TransactionsByBlock',
|
||||||
'TransactionsByAddress',
|
'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.global = Global;
|
||||||
|
|
||||||
$scope.findThis = function() {
|
$scope.findThis = function() {
|
||||||
@ -43,10 +44,12 @@ angular.module('insight.transactions').controller('transactionsController',
|
|||||||
$scope.txs = txs;
|
$scope.txs = txs;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
/*socket.on('tx', function(tx) {
|
var socket = get_socket($scope);
|
||||||
console.log('Incoming message for new transaction!', tx);
|
console.log('transactions.js');
|
||||||
|
socket.on('atx', function(tx) {
|
||||||
|
console.log('Incoming transaction for address!', tx);
|
||||||
$scope.findTx(tx.txid);
|
$scope.findTx(tx.txid);
|
||||||
});*/
|
});
|
||||||
|
|
||||||
$scope.txs = [];
|
$scope.txs = [];
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,8 @@ var ScopedSocket = function(socket, $rootScope) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ScopedSocket.prototype.removeAllListeners = function() {
|
ScopedSocket.prototype.removeAllListeners = function() {
|
||||||
console.log('remove all listeners');
|
|
||||||
for (var i = 0; i < this.listeners.length; i++) {
|
for (var i = 0; i < this.listeners.length; i++) {
|
||||||
var details = this.listeners[i];
|
var details = this.listeners[i];
|
||||||
console.log('removing listener '+i);
|
|
||||||
this.socket.removeListener(details.event, details.fn);
|
this.socket.removeListener(details.event, details.fn);
|
||||||
}
|
}
|
||||||
this.listeners = [];
|
this.listeners = [];
|
||||||
@ -20,7 +18,6 @@ ScopedSocket.prototype.on = function(event, callback) {
|
|||||||
var socket = this.socket;
|
var socket = this.socket;
|
||||||
var $rootScope = this.$rootScope;
|
var $rootScope = this.$rootScope;
|
||||||
|
|
||||||
|
|
||||||
var wrapped_callback = function() {
|
var wrapped_callback = function() {
|
||||||
var args = arguments;
|
var args = arguments;
|
||||||
$rootScope.$apply(function() {
|
$rootScope.$apply(function() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user