code: async def _wrap_ws(self, handler, *args, **kwargs):
          ''' wraps a handler by receiving a websocket request and returning a websocket response '''
          try:
              method = self.request_method()
              # call the wrapped handler
              data = await handler(self, *args, **kwargs)
              status = self.responses.get(method, OK)
              response = {
                  'type': 'response',
                  'key': getattr(self.request, 'key', None),
                  'status': status,
                  'payload': data
              }
          except Exception as ex:
              response = {
                  'type': 'response',
                  'key': getattr(self.request, 'key', None),
                  'status': getattr(ex, 'status', 500),
                  'payload': getattr(ex, 'msg', 'general error')
              }
          # return a formatted response object
          return self.format(method, responseync def _wrap_ws(self, handler, *args, **kwargs):
          ''' wraps a handler by receiving a websocket request and returning a websocket response '''
          try:
              method = self.request_method()
              # call the wrapped handler
              data = await handler(self, *args, **kwargs)
              status = self.responses.get(method, OK)
              response = {
                  'type': 'response',
                  'key': getattr(self.request, 'key', None),
                  'status': status,
                  'payload': data
              }
          except Exception as ex:
              response = {
                  'type': 'response',
                  'key': getattr(self.request, 'key', None),
                  'status': getattr(ex, 'status', 500),
                  'payload': getattr(ex, 'msg', 'general error')
              }
          # return a formatted response object
          return self.format(method, response)
docs: wraps a handler by receiving a websocket request and returning a websocket response