fix many socket related issuers
This commit is contained in:
parent
ec3f05cb75
commit
6eff53b379
20
README.md
20
README.md
|
@ -63,9 +63,25 @@ There is a convinent Gruntfile.js for automation during editing the code
|
|||
|
||||
```$ grunt```
|
||||
|
||||
and if you are develping the API also, run:
|
||||
|
||||
```INSIGHT_PUBLIC_PATH=../insight/public grunt```
|
||||
|
||||
In case you are develping *insight* and *insight-api* toghether, you can do the following:
|
||||
|
||||
* Install insight and insight-api on the same path ($IROOT)
|
||||
```
|
||||
$ cd $IROOT/insight
|
||||
$ grunt
|
||||
```
|
||||
in other terminal:
|
||||
```
|
||||
$ cd $IROOT/insight-api
|
||||
$ ln -s ../insight/public
|
||||
$ INSIGHT_PUBLIC_PATH=public node insight.js
|
||||
```
|
||||
|
||||
|
||||
```INSIGHT_PUBLIC_PATH=insight/public grunt```
|
||||
at insight-api's home path (edit the path according your setup).
|
||||
|
||||
**also** in the insight-api path. (So you will have to grunt process running, one for insight and one for insight-api).
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -2,6 +2,7 @@
|
|||
-------------------------------------------------- */
|
||||
@charset "UTF-8";
|
||||
|
||||
|
||||
html,
|
||||
body {
|
||||
color: #373D42;
|
||||
|
|
|
@ -4,8 +4,28 @@ angular.module('insight.address').controller('AddressController',
|
|||
function($scope, $rootScope, $routeParams, $location, Global, Address, getSocket) {
|
||||
$scope.global = Global;
|
||||
|
||||
|
||||
var socket = getSocket($scope);
|
||||
|
||||
var _startSocket = function () {
|
||||
socket.emit('subscribe', $routeParams.addrStr);
|
||||
socket.on($routeParams.addrStr, function(tx) {
|
||||
$rootScope.$broadcast('tx', tx);
|
||||
var beep = new Audio('/sound/transaction.mp3');
|
||||
beep.play();
|
||||
});
|
||||
};
|
||||
|
||||
socket.on('connect', function() {
|
||||
_startSocket();
|
||||
});
|
||||
|
||||
$scope.params = $routeParams;
|
||||
|
||||
|
||||
$scope.findOne = function() {
|
||||
$rootScope.currentAddr = $routeParams.addrStr;
|
||||
_startSocket();
|
||||
|
||||
Address.get({
|
||||
addrStr: $routeParams.addrStr
|
||||
|
@ -27,15 +47,4 @@ angular.module('insight.address').controller('AddressController',
|
|||
});
|
||||
};
|
||||
|
||||
var socket = getSocket($scope);
|
||||
socket.on('connect', function() {
|
||||
socket.emit('subscribe', $routeParams.addrStr);
|
||||
socket.on($routeParams.addrStr, function(tx) {
|
||||
console.log('AddressTx event received ' + tx);
|
||||
$rootScope.$broadcast('tx', tx);
|
||||
});
|
||||
});
|
||||
|
||||
$scope.params = $routeParams;
|
||||
|
||||
});
|
||||
|
|
|
@ -38,6 +38,7 @@ angular.module('insight.system').controller('HeaderController',
|
|||
socket.emit('subscribe', 'inv');
|
||||
|
||||
socket.on('block', function(block) {
|
||||
console.log('[header.js.40:block:]',block); //TODO
|
||||
var blockHash = block.toString();
|
||||
_getBlock(blockHash);
|
||||
});
|
||||
|
|
|
@ -17,9 +17,9 @@ angular.module('insight.system').controller('IndexController',
|
|||
};
|
||||
|
||||
var socket = getSocket($scope);
|
||||
socket.on('connect', function() {
|
||||
socket.emit('subscribe', 'inv');
|
||||
|
||||
var _startSocket = function() {
|
||||
socket.emit('subscribe', 'inv');
|
||||
socket.on('tx', function(tx) {
|
||||
$scope.txs.unshift(tx);
|
||||
if (parseInt($scope.txs.length, 10) >= parseInt(TRANSACTION_DISPLAYED, 10)) {
|
||||
|
@ -30,9 +30,14 @@ angular.module('insight.system').controller('IndexController',
|
|||
socket.on('block', function() {
|
||||
_getBlocks();
|
||||
});
|
||||
};
|
||||
|
||||
socket.on('connect', function() {
|
||||
_startSocket();
|
||||
});
|
||||
|
||||
|
||||
|
||||
$scope.humanSince = function(time) {
|
||||
var m = moment.unix(time);
|
||||
return m.max().fromNow();
|
||||
|
@ -40,6 +45,7 @@ angular.module('insight.system').controller('IndexController',
|
|||
|
||||
$scope.index = function() {
|
||||
_getBlocks();
|
||||
_startSocket();
|
||||
};
|
||||
|
||||
$scope.txs = [];
|
||||
|
|
|
@ -26,7 +26,21 @@ angular.module('insight.status').controller('StatusController',
|
|||
$scope.sync = sync;
|
||||
};
|
||||
|
||||
var _startSocket = function () {
|
||||
socket.emit('subscribe', 'sync');
|
||||
socket.on('status', function(sync) {
|
||||
_onSyncUpdate(sync);
|
||||
});
|
||||
};
|
||||
|
||||
var socket = getSocket($scope);
|
||||
socket.on('connect', function() {
|
||||
_startSocket();
|
||||
});
|
||||
|
||||
|
||||
$scope.getSync = function() {
|
||||
_startSocket();
|
||||
Sync.get({},
|
||||
function(sync) {
|
||||
_onSyncUpdate(sync);
|
||||
|
@ -38,12 +52,4 @@ angular.module('insight.status').controller('StatusController',
|
|||
};
|
||||
});
|
||||
};
|
||||
|
||||
var socket = getSocket($scope);
|
||||
socket.on('connect', function() {
|
||||
socket.emit('subscribe', 'sync');
|
||||
socket.on('status', function(sync) {
|
||||
_onSyncUpdate(sync);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue