I'm using the easyApi to interact with the library and I wanted to periodically check if the session is online i.e there's no issue with the host phone or the server on which the library is running.
I tried to test it by turning off internet on the host phone and hitting the /getConnectionState, /getMe or similar endpoints of the easyApi but I'm still getting a successful response. The /getSnapshot endpoint also shows that WA Web is running normally.
The only workaround I could find was hitting the /refresh endpoint, after which /getConnectionState returns an offline status. Is there an alternative?
Looks like it will only update connection state when you try to do something that requires contacting the host account device. If anything I'll have to trick it into pinging the device every time you call getConnectionState
@shubham0804 please restart your session and try again. Although getConnectionState() now takes about 4 seconds to resolve, it will be much more reliable and up to date.
If you ever want to 'wake up' the connection between the session and the host device just call getConnectionState()
Please report back if it working for you.
changing getConnectionState caused issues so now I've implemented client.forceUpdateConnectionState() instead.
@github-actions run
âš¡ Release! âš¡
(async () => {
function exec(cmd) {
console.log(execSync(cmd).toString());
}
// Config
const gitUserEmail = "github-actions[bot]@users.noreply.github.com";
const gitUserName = "github-actions[bot]";
exec(`echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc`);
exec(`git config --global user.email "${gitUserEmail}"`);
exec(`git config --global user.name "${gitUserName}"`);
exec(`npm i`);
exec(`npm run release-ci`);
//comment on the issue
var result = execSync(`npx auto-changelog -o ./tempchangelog.txt --commit-limit false --template ./compact-keepachangelog.hbs --stdout`).toString();
await postComment(result);
//create changelog image
exec(`npm run release-image`);
exec(`git commit -a -m 'updated release-image'`);
exec(`git push --force`);
})();
#1052#1061afd46ca401 information to docs #1070 8d6f554forceUpdateConnectionState() #1072 3b03950--headful to launch browser window c2cfbacneedsToScan error on kill #1063 96e49791ca07fbclient.kill() from being called twice. 7a045995d1167bloadAndGetAllMessagesInChat #1051 64771054d48454client.forceUpdateConnectionState() has solved the issue! Would it be possible to call it through the easyApi?
Never mind. It's working through the easyApi after updating. Thanks!