SHARE
TWEET

Untitled

a guest Jun 16th, 2019 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import asyncio
  2. import websockets
  3. import time
  4.  
  5. async def hello():
  6.     while True:
  7.         async with websockets.connect('ws://test.com:3636') as websocket:
  8.             await websocket.send('test')
  9.             greeting = await websocket.recv()
  10.             print(f"< {greeting}")
  11.             time.sleep(10)
  12. asyncio.get_event_loop().run_until_complete(hello())
  13. asyncio.get_event_loop().run_forever()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top