title: How can I implement asyncio websockets in a class?
body: <p>I would like to connect to a websocket via <code>asyncio</code> and <code>websockets</code>, with a format as shown below. How would I be able to accomplish this?</p>
  
  <pre><code>from websockets import connect
  
  
  class EchoWebsocket:
  
      def __init__(self):
          self.websocket = self._connect()
  
      def _connect(self):
          return connect("wss://echo.websocket.org")
  
      def send(self, message):
          self.websocket.send(message)
  
      def receive(self):
          return self.websocket.recv()
  
  echo = EchoWebsocket()
  echo.send("Hello!")
  print(echo.receive())  # "Hello!"
  </code></pre>