mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-13 01:30:31 +08:00
wscli: timestamps
This commit is contained in:
parent
67439d6194
commit
fb60b0dd60
@ -5,6 +5,7 @@ import sys
|
|||||||
import signal
|
import signal
|
||||||
import asyncio
|
import asyncio
|
||||||
import argparse
|
import argparse
|
||||||
|
import time
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
@ -24,12 +25,12 @@ async def _run_client(loop: asyncio.AbstractEventLoop, url: str) -> None:
|
|||||||
while True:
|
while True:
|
||||||
msg = await ws.receive()
|
msg = await ws.receive()
|
||||||
if msg.type == aiohttp.WSMsgType.TEXT:
|
if msg.type == aiohttp.WSMsgType.TEXT:
|
||||||
print("Received:", msg.data.strip())
|
print("[%.5f] Received: %s" % (time.time(), msg.data.strip()))
|
||||||
else:
|
else:
|
||||||
if msg.type == aiohttp.WSMsgType.CLOSE:
|
if msg.type == aiohttp.WSMsgType.CLOSE:
|
||||||
await ws.close()
|
await ws.close()
|
||||||
elif msg.type == aiohttp.WSMsgType.ERROR:
|
elif msg.type == aiohttp.WSMsgType.ERROR:
|
||||||
print("Error during receive:", ws.exception())
|
print("[%.5f] Error during receive: %s" % (time.time(), ws.exception()))
|
||||||
elif msg.type == aiohttp.WSMsgType.CLOSED:
|
elif msg.type == aiohttp.WSMsgType.CLOSED:
|
||||||
pass
|
pass
|
||||||
break
|
break
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user