Skip to content
Advertisement

Push live updates through Socket

I need to pass live data from a python script to my server (made with FastApi) and from this server I need to pass all of them to a client (made with Angular).

Currently I’m doing Http PUT requests from my script and then I’m using Websocket to pass the updates to the client.

The problem is that whenever my server socket is connected, I can’t receive any http requests from my script.

If this solution is not viable, what others might be? And why?

I share my dummy code:

script.py

JavaScript

myserver.py

JavaScript

Client implementation is irrelevant.

Advertisement

Answer

I used a Socket to transmit data from the script to my server and a WebSocket to transmit data from my server to the client.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement