#!/usr/bin/python3
 
import time

"""Client using the asyncio API."""
# works for versions 10.x and 15.x 

import asyncio
try:
  from websockets.asyncio.client import connect
except:
  from websockets import connect
  
async def hello():
    async with connect("ws://localhost:8888") as websocket:
        nr="Hello world "+str(time.time())
        await websocket.send(nr)
        message = await websocket.recv()
        print(message,message==nr)

if __name__ == "__main__":
    asyncio.run(hello())
