title: Simple way to test websocket availability in python
body: <p>I am using the following code to test that a local websocket server is running:</p>
  
  <pre><code>import asyncio
  import websockets
  
  async def hello():
      async with websockets.connect('ws://127.0.0.1:8000/ws/registration/123') as websocket:
          await websocket.send(json_data)
  
  asyncio.get_event_loop().run_until_complete(hello())
  </code></pre>
  
  <p>Is there a simpler way to do this without using asyncio? Something such as:</p>
  
  <pre><code>import asyncio
  import websockets
  
  conn = websockets.connect('ws://127.0.0.1:8000/ws/registration/123')
  conn.send('hello')
  </code></pre>
  
  <p>Basically, I'm just trying to find the simplest way to test to see if my websocket server is listening and receiving messages at a particular url.</p>