title: WebSocket closes immediately after opening/send
body: <p>I'm making a simple chat using <code>websockets</code> on client and <code>flask</code> + <code>flask_sockets</code> on server. </p>
  
  <p>When the client gets their token, connects to a websocket and sends a message, <code>websockets.exceptions.ConnectionClosed</code> appears</p>
  
  <p>Client code:</p>
  
  <pre class="lang-py prettyprint-override"><code>async def main(token):
      async with websockets.connect(f'ws://localhost:5000/ws?token={token}') as ws:
          await ws.send(input('&gt; '))
          print(await ws.recv())
  
  if __name__ == '__main__':
      username = input('Your username &gt;&gt;&gt; ').strip()
      token = get(f'http://localhost:5000/getToken?username={username}').text
      print(f"Got token: {token}")
  
      while True:
          asyncio.get_event_loop().run_until_complete(main(token))
  </code></pre>
  
  <p>Server WebSocket handler:</p>
  
  <pre class="lang-py prettyprint-override"><code>class User:
      ws = None
  
      def __init__(self, username):
          self.username = username
  
  
  @sockets.route('/ws')
  def alert(ws):
      token = request.args.get('token')
      if token in users:
          user = users[token]
          user.ws = ws
          print(f'Connected user {token}')
      print(users[token].username, '&gt;&gt;&gt;', ws.receive())
  </code></pre>
  
  <p>I expect the connection to stay open so when a new message appears server would send it to all clients using something like</p>
  
  <pre class="lang-py prettyprint-override"><code>for user in users:
      user.ws.send(message)
  </code></pre>
  
  <p>P.S. this is my first post on StackOverflow, so any corrections are welcome :)</p>