I am now trying to use Pusher, and JQuery to send messages and update the flask webpage dynamically
Pusher is a hosted service that makes it super-easy to add real-time data and functionality to web and mobile applications. Pusher sits as a real-time layer between your servers and your clients. ... Pusher offers libraries to integrate into all the main runtimes and frameworks. PHP, Ruby, Python, Java......
How this works
When a message is sent on the webpage, the message is passed from the webpage to the flask server. The flask server will then call the Pusher API. The Pusher API will receive the message and pass the message to all the clients that are connected, aka us. So, essentially the messages go from our webpage to flask, to pusher and back to our own webpage. Why did I choose to do it this way? Because this allows for easy integration to servers. It is one of the easiest ways to implement message sending functions and also it allows for multiple clients at once. So it is more possible to have multiple consoles open at once (Which I want to leave as a possible feature that we can implement if we wish).
I managed to pass data from javascript to the flask server. The flask server was also able to call the Pusher API and the Pusher API was able to pass data back to the client, which is our webpage. Overall, it was a success. However, I am still left with the task of appending messages received from Pusher API to the webpage itself. Right now it is only a Data Alert javascript.
In the HTML Page
In the Python main routes.py file
Comentarios