dimaskiddo/go-whatsapp-multidevice-rest

Session storage in postgres?

Closed this issue ยท 7 comments

If you store sessions in postgress, will this API work?
https://github.com/tulir/whatsmeow can store sessions there.

Currently this repository core package is using sqlite3 since then i can split the database for multi-session with different phone number

If you want to modify to use postgresql or other database with this repository please make sure it can use multiple database to keep support of multi-session

even though you can adding more functionality since tulir/whatsmeow has capabilities to put session in the store directly, it's mean that we can use single database rather than splitting it into multiple database to support multi-session

But currently for this repo i'll keep using sqlite3 first since i need more exploration and time to make it happens ๐Ÿ˜„

If I understand correctly, tvnatsmeovn already knows how to store several sessions in one database https://github.com/tulir/whatsmeow/blob/8b34d886d543/client.go#L139, which can make life much easier, maybe you should add settings and, depending on them, choose one or another method for storing sessions? If I'm not mistaken, even in sqllite you can store multiple sessions in one file, you only need to change WhatsAppInit/WhatsAppLogout

Not much to rewrite yet :)

This will allow you to use sqllite or postgresql of your choice

Hi @Diden05

I already refactor the code to support multi datastore driver, currently it's in develop branch
I hope you can help me to test it, because i currently i don't test it yet with actual login or restarting the service

Multi Session is still keeped in mapped client variable since in my exploration datastore is only record the client data but not the client connection it's self

Thanks

I already refactor the code to support multi datastore driver, currently it's in develop branch I hope you can help me to test it, because i currently i don't test it yet with actual login or restarting the service

Hi @dimaskiddo!

Constantly getting "Error Connect WhatsApp Client Datastore" error after running docker container

Database file not created in dbs folder

Error: "failed to upgrade database: Binary was compiled with 'CGO_ENABLED=0', go-sqlite3 requires cgo to work. This is a stub"

@dimaskiddo The data of several sessions in the database is saved normally, after the container is restarted, the sessions are normally restored, I sent a small fix so that the database in docker works correctly

Thanks for helping me tesing it @Diden05
I'll close this issue then ๐Ÿ˜„๐Ÿป