I have set up a LAMP (Linux, Apache, MariaDB, PHP) Server on my Raspberry PI and I'm able to use HTTP GET and PUSH Requests to get and push Data from/to the MariaDB database via php code in the local network.
What I want to do:
Now I want to use a second client to edit a table in the Database. The first client should display the changes in real-time on an Flutter App.
At the Moment I can only actively request if the data has changed in the DB with a HTTP GET request so to reach real-time speed, my app has to sent multiple GET requests per seconds which is obviously not what i was going for because the APP needs to stay responsive and should use the least CPU power as possible.
Therefore I try to send a signal from the php-Server to the flutter App. This way the Flutter-App can wait passive until the data in the DB has changed.
My approaches to this problem:
I have read about websockets which seem to be the solution to this problem however I still have no clue how too implement it with a LAMP Stack.
Can somebody explain how websockets work and give tips on how to start the implementation with a LAMP Stack and Flutter App?
Thank you for your help, Paul