I have a websocket app that gets real time data through a polygon (ethereum) websocket:
async def get_event():
async with connect(infura_ws_url) as ws:
await ws.send(rpc)
subscription_response = await ws.recv()
print(subscription_response)
while True:
try:
message = await asyncio.wait_for(ws.recv(), timeout=150)
response = json.loads(message)
txHash = response['params']['result']
.....
this app works with no issues locally: every 150 seconds I get the “waiting for message” print on the console if no messages.
When I deploy it to fly.io, I get the incoming messages in bursts. I get nothing on the monitoring page for 5/10 minutes, then suddenly a burst of messages, then nothing for 30/40min, then another burst.
How can I debug this issue?
Thanks