Go-whatsapp: Session Too Short

Created on 25 Dec 2019  路  9Comments  路  Source: Rhymen/go-whatsapp

Session lasts only about 12 hour after than to continue QR Code scan needed,however in whatsapp you can continue to session forever.
Any idea for solution?

Most helpful comment

There are some things to consider regarding session keeping
1) Yes, the phone should be connected while restoring the session. Failing to do so will result in a "restore session timed out" error. So check your phone and try opening and closing the app sometimes.
2) Make sure the session is properly listed in the app - if not you will get a 401 result
3) While testing here I realised that if you do not write the session when shutting down, the restore will get way slower, making it hard or even impossible to restore session in time. Remember to defer the session write somehow before your code exits

All 9 comments

Session lasts only about 12 hour after than to continue QR Code scan needed,however in whatsapp you can continue to session forever.
Any idea for solution?

It's not like that for me, until you logout/delete the session it will be last forever

I use echo part of project,however 1 day later or 12 hours later,session ended
so interesting...

I use echo part of project,however 1 day later or 12 hours later,session ended
so interesting...

Did you logout from phone or using logout function?

nope,maybe os.TempDir() path changes every reboot my pc?because session was put in TempDir()/whatsappgob.gob
I use macOS not ubuntu or windows etc.

nope,maybe os.TempDir() path changes every reboot my pc?because session was put in TempDir()/whatsappgob.gob
I use macOS not ubuntu or windows etc.

I think that's your issue. To keep your session you should store the whatsappgob.gob file in another directory since the tmp dir gets cleaned every reboot (basically)

Yeap i store session elsewhere and it works nice.

I have same issue, but session stored properly. Maybe it drop session when phone app offline for N time?

There are some things to consider regarding session keeping
1) Yes, the phone should be connected while restoring the session. Failing to do so will result in a "restore session timed out" error. So check your phone and try opening and closing the app sometimes.
2) Make sure the session is properly listed in the app - if not you will get a 401 result
3) While testing here I realised that if you do not write the session when shutting down, the restore will get way slower, making it hard or even impossible to restore session in time. Remember to defer the session write somehow before your code exits

Yes, the phone should be connected while restoring the session. Failing to do so will result in a "restore session timed out" error. So check your phone and try opening and closing the app sometimes.

Nice work. Whatsapp is nightmare..

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jhow2892 picture jhow2892  路  3Comments

it-sumanp picture it-sumanp  路  8Comments

Leonardo-Crespo picture Leonardo-Crespo  路  6Comments

xnodcorp picture xnodcorp  路  3Comments

Manjit2003 picture Manjit2003  路  9Comments