diff --git a/app/controllers/socket.js b/app/controllers/socket.js index acfa2c9..0ff3b4a 100644 --- a/app/controllers/socket.js +++ b/app/controllers/socket.js @@ -27,5 +27,6 @@ module.exports.broadcast_address_tx = function(address, tx) { }; module.exports.broadcastSyncInfo = function(syncInfo) { - ios.sockets.emit('sync', syncInfo); + console.log('broadcastSyncInfo'); + ios.sockets.in('sync').emit('status', syncInfo); }; diff --git a/public/js/controllers/footer.js b/public/js/controllers/footer.js index e9d5c42..7cdfb57 100644 --- a/public/js/controllers/footer.js +++ b/public/js/controllers/footer.js @@ -1,16 +1,8 @@ 'use strict'; angular.module('insight.system').controller('FooterController', - function ($scope, Global, Status) { + function ($scope, Global) { $scope.global = Global; - $scope.getFooter = function() { - Status.get({ - q: 'getInfo' - }, function(d) { - $scope.info = d.info; - }); - }; - }); diff --git a/public/js/controllers/status.js b/public/js/controllers/status.js index 019c04d..267dac2 100644 --- a/public/js/controllers/status.js +++ b/public/js/controllers/status.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('insight.status').controller('StatusController', - function ($scope, $routeParams, $location, $rootScope, Global, Status, Sync) { + function ($scope, $routeParams, $location, $rootScope, Global, Status, Sync, get_socket) { $scope.global = Global; $scope.getStatus = function(q) { @@ -28,5 +28,12 @@ angular.module('insight.status').controller('StatusController', $rootScope.syncError = 'Could not get sync information' + e; }); }; + + var socket = get_socket($scope); + socket.emit('subscribe', 'sync'); + socket.on('status', function(info) { + console.log('info '+JSON.stringify(info)); + }); + }); diff --git a/public/views/header.html b/public/views/header.html index 6d12e44..aae4753 100755 --- a/public/views/header.html +++ b/public/views/header.html @@ -22,9 +22,9 @@