connection handler failedTraceback (most recent call last):File "/usr/local/lib/python3.10/site-packages/websockets/legacy/server.py", line 240, in handlerawait self.ws_handler(self)File "/app/test.py", line 8, in echoawait websocket.send(message)File "/usr/local/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 635, in sendawait self.ensure_open()File "/usr/local/lib/python3.10/site-packages/websockets/legacy/protocol.py", line 944, in ensure_openraise self.connection_closed_exc()websockets.exceptions.ConnectionClosedOK: received 1000 (OK); then sent 1000 (OK)
async def send_data(): uri = "wss://test-production-6637.up.railway.app/" async with websockets.connect(uri) as websocket: sensor_data = { "temperature": random.uniform(20.0, 25.0), "humidity": random.uniform(30.0, 40.0), } await websocket.send(json.dumps(sensor_data))asyncio.get_event_loop().run_until_complete(send_data())