Changes updated
This commit is contained in:
parent
92efe7e8d1
commit
3db3ea2a1a
@ -193,16 +193,20 @@ console.log(__dirname);
|
||||
universalGetLatestBlockDetails('Testnet');
|
||||
universalGetLatestBlockDetails('Floonet');
|
||||
});
|
||||
var interval;
|
||||
const io = require("socket.io").listen(server);
|
||||
io.sockets.on("connection", socket => {
|
||||
// if (interval) {
|
||||
// clearInterval(interval);
|
||||
// }
|
||||
//console.log(socket.handshake.query.network);
|
||||
//var network = "Testnet";
|
||||
let key = process.env.REDIS_KEY + socket.handshake.query.network + 'Latest_Block_details'
|
||||
setInterval(function() {
|
||||
interval = setInterval(function() {
|
||||
Global.client.get(key, function(err, reply){
|
||||
socket.emit("latestblockdetail", JSON.parse(reply) );
|
||||
});
|
||||
},1000);
|
||||
},10000);
|
||||
//socket.on("disconnect", () => console.log("Client disconnected"));
|
||||
});
|
||||
})
|
||||
|
@ -59,6 +59,7 @@ export class ChartService {
|
||||
}
|
||||
|
||||
|
||||
|
||||
public getLatestblockdetails() {
|
||||
if(this.socket==null){
|
||||
this.socket = io.connect(this.server, {requestTimeout:100000000,query: 'network='+this.socketnetwork});
|
||||
|
@ -65,7 +65,7 @@ export class LatestblocksComponent implements OnInit {
|
||||
//console.log(this.blockdetails);
|
||||
if (this.lastblock != this.blockdetails.block_height) {
|
||||
//console.log('Create');
|
||||
this.createBlock();
|
||||
//this.createBlock();
|
||||
}
|
||||
this.lastblock = this.blockdetails.block_height;
|
||||
//console.log(this.lastblock);
|
||||
|
Loading…
Reference in New Issue
Block a user