I am finding that the endpoint runs without a user ever arriving at that endpoint.
Example:
app.ws('/tracker', function(ws, req) {
var indexOfMock = 0;
//Send current week's team to only the connected client;
function nextPoll() {
var p1 = MockAPIPolling(indexOfMock).then(apires => { return apires; })
var p2 = pool.query(api.MainLeagueStatTrackerData, [api.GetCurrentWeek()]).then(data => { return data.rows })
return Promise.all([p1, p2]).then(([results, league]) => {
if (returnObj.broadcast) {
var model = StatTrackerVMCreator.Create(results, league);
wss.clients.forEach(client => {
client.send(JSON.stringify(model))
})
}
if (!returnObj.raceFinished) { //taking off the if to let it run continuously on test
return setTimeout(nextPoll, 5000)
}
})
}
nextPoll();
})
I am finding that the endpoint runs without a user ever arriving at that endpoint. Example:
Full file in the repo can be found here.