code: def wait(self):
          
          while True:
              if self._req_ctx is not None:
                  try:
                      msg = uwsgi.websocket_recv(request_context=self._req_ctx)
                  except IOError:  # connection closed
                      return None
                  return self._decode_received(msg)
              else:
                  # we wake up at least every 3 seconds to let uWSGI
                  # do its ping/ponging
                  event_set = self._event.wait(timeout=3)
                  if event_set:
                      self._event.clear()
                      # maybe there is something to send
                      msgs = []
                      while True:
                          try:
                              msgs.append(self._send_queue.get(block=False))
                          except gevent.queue.Empty:
                              break
                      for msg in msgs:
                          self._send(msg)
                  # maybe there is something to receive, if not, at least
                  # ensure uWSGI does its ping/ponging
                  try:
                      msg = uwsgi.websocket_recv_nb()
                  except IOError:  # connection closed
                      self._select_greenlet.kill()
                      return None
                  if msg:  # message available
                      return self._decode_received(msg)
docs: Waits and returns received messages.
          If running in compatibility mode for older uWSGI versions,
          it also sends messages that have been queued by send().
          A return value of None means that connection was closed.
          This must be called repeatedly. For uWSGI < 2.1.x it must
          be called from the main greenlet.