def ddp_frames_from_message(self, message):
        """Yield DDP messages from a raw WebSocket message."""
        # parse message set
        try:
            msgs = ejson.loads(message)
        except ValueError:
            self.reply(
                'error', error=400, reason='Data is not valid EJSON',
            )
            raise StopIteration
        if not isinstance(msgs, list):
            self.reply(
                'error', error=400, reason='Invalid EJSON messages',
            )
            raise StopIteration
        # process individual messages
        while msgs:
            # pop raw message from the list
            raw = msgs.pop(0)
            # parse message payload
            try:
                data = ejson.loads(raw)
            except (__HOLE__, ValueError):
                data = None
            if not isinstance(data, dict):
                self.reply(
                    'error', error=400,
                    reason='Invalid SockJS DDP payload',
                    offendingMessage=raw,
                )
            yield data
            if msgs:
                # yield to other greenlets before processing next msg
                gevent.sleep()
dataset/ETHPy150Open django-ddp/django-ddp/dddp/websocket.py/DDPWebSocketApplication.ddp_frames_from_message