Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make variable persistent on close/open connection #416

Open
vincenthure opened this issue Dec 3, 2021 · 2 comments
Open

make variable persistent on close/open connection #416

vincenthure opened this issue Dec 3, 2021 · 2 comments

Comments

@vincenthure
Copy link

Hello,
My setup is
Busybox httpd as web server
webscocketd –port 8080 python3 pilot. py
In my python program I have global variable and I can modify them with button in my web page
It’s working very good , bi-directional so I can show the value on the web page.
My problem is when I reload my web page the variable are set to their default value.
How can I do to make this variable persistent on open/close connection?
Vincent

@asergeyev
Copy link
Collaborator

Every connection spins another copy of your python program. In order to save anything between them you need some sort of storage. This could be as simple as small local file or as complex as external database (memcached/redis/dynamodb/mysql - your call)

I don't know much about python but according to docs it can do mmap too: https://docs.python.org/3/library/mmap.html
could be interesting choice if you are on system that supports it.

@vincenthure
Copy link
Author

Thank you for your help.
I finaly choice to install a small SQLite3 database and It work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants