I am trying to get the live prices of crypto tokens in binance.I used websockets for that.
Code:
import websockets
import asyncio
async def hello():
async with websockets.connect('wss://fstream.binance.com/ws/!markPrice@arr') as websocket:
print("connected!")
while True:
print("Debug")
greeting = await websocket.recv()
print(greeting)
await client.close_connection()
asyncio.run(hello())
This is code working fine in local linux machine (means it's printing the data coming from web socket which is being stored in greeting variable.)
At the same time without changing any code in that, I run that in aws ec2 ubuntu instance,it's doing nothing, just printing connected! and Debug. After that nothing print on console and no any error raised.
I installed web sockets latest version.