I have an external Python script which generates JSON data every second; on the other side i have a Django application. I would like to stream that data on a webpage on my Django app. I already built a consumer with Django channels, but i don't know how to make Django have the data that i generate from the other Python script.
Here is my basic consumer:
class EchoConsumer(AsyncConsumer):
async def websocket_connect(self, event):
print("connected", event)
await self.send({
"type": "websocket.accept"
})
async def websocket_receive(self, event):
print("received", event)
# Echo the same received payload
async def websocket_disconnect(self, event):
print("disconnected", event)
Is there a specific way do this? Or am i supposed to use another service in the middle?Any advice is appreciated