Adding ZMQ and SocketIO access.

This commit is contained in:
Alexander Blair
2017-03-05 13:56:06 -08:00
parent 9e08dbbc90
commit 1f9fe310c0
4 changed files with 271 additions and 148 deletions
+4
View File
@@ -4,12 +4,15 @@ const async = require("async");
const debug = require("debug")("payments");
const request = require('request-json');
const range = require('range');
const zmq = require('zmq');
const sock = zmq.socket('pub');
let hexChars = new RegExp("[0-9a-f]+");
let bestExchange = global.config.payout.bestExchange;
let xmrAPIClient = request.createClient('https://xmr.to/api/v1/xmr2btc/');
let extraPaymentRound = false;
let paymentTimer = null;
sock.bindSync('tcp://127.0.0.1:3001');
let shapeshiftQueue = async.queue(function (task, callback) {
// Amount needs to be shifted in as a non-completed value, as the wallet will only take non-complete values..
@@ -344,6 +347,7 @@ paymentQueue.drain = function(){
extraPaymentRound = false;
paymentTimer = setInterval(makePayments, global.config.payout.timer * 60 * 1000);
global.database.setCache('lastPaymentCycle', Math.floor(Date.now()/1000));
sock.send(['payments', 'complete']);
};
function updateShapeshiftCompletion() {