Add a delay to calling client.disconnect as a workaround for it being called too early and websocket connection not being established.

This commit is contained in:
Jakub Filo 2023-04-30 16:43:59 +00:00
parent d8104cd70d
commit b04ba0b100

View File

@ -127,7 +127,9 @@ async function run() {
const client = new Client(username, password); const client = new Client(username, password);
await client.connect(); await client.connect();
data.state = client.getState; data.state = client.getState;
setTimeout(async () => {
await client.disconnect(); await client.disconnect();
}, 2000);
} catch (err) { } catch (err) {
log.verbose("Failed to log in as new user, perhaps the password is wrong?"); log.verbose("Failed to log in as new user, perhaps the password is wrong?");
log.silly(err); log.silly(err);