Open kvrzh opened 1 month ago
This is caused because when the process is created the internal server has not yet had time to initialize and is not ready to take requests. This error on connection could be fixed by a loop calling the client and catching any ECONNREFUSED errors similar to what we did with web sockets. Adding something like this in the authenticate function would prevent said error during startup
return new Promise<Credentials>(function testConnection(resolve, reject) {
createHttp1Request({ method: 'GET', url: '/process-control/v1/process' }, credentials)
.then(() => resolve(credentials))
.catch((err) => {
if (err.code === 'ECONNREFUSED') {
setTimeout(testConnection, pollInterval, resolve, reject)
} else {
reject(err)
}
})
})
I have no problem creating a PR that adds it if that's a feature @junlarsen would like. My question would be if it's a new connection option or added to awaitConnection
Hey, you have very good project, but i have some problem, this code will fail in 100% times, when you are not in LOL, then you enter the game. Seems like session is not rdy to make requests...
Also, just a proposal, will be to trigger client.on('connect', () => {}) even on first start of game)