websocketd
websocketd copied to clipboard
make variable persistent on close/open connection
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
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.
Thank you for your help. I finaly choice to install a small SQLite3 database and It work fine.