コード例 #1
0
                return s

        def unserialize(self, payload):
            """
            Implements :func:`autobahn.wamp.interfaces.IObjectSerializer.unserialize`
            """
            if self._batched:
                chunks = payload.split(b'\30')[:-1]
            else:
                chunks = [payload]
            if len(chunks) == 0:
                raise Exception("batch format error")
            return [_loads(data.decode('utf8')) for data in chunks]


IObjectSerializer.register(JsonObjectSerializer)


class JsonSerializer(Serializer):

    SERIALIZER_ID = u"json"
    """
    ID used as part of the WebSocket subprotocol name to identify the
    serializer with WAMP-over-WebSocket.
    """

    RAWSOCKET_SERIALIZER_ID = 1
    """
    ID used in lower four bits of second octet in RawSocket opening
    handshake identify the serializer with WAMP-over-RawSocket.
    """
コード例 #2
0
                return s

        def unserialize(self, payload):
            """
            Implements :func:`autobahn.wamp.interfaces.IObjectSerializer.unserialize`
            """
            if self._batched:
                chunks = payload.split(b'\30')[:-1]
            else:
                chunks = [payload]
            if len(chunks) == 0:
                raise Exception("batch format error")
            return [_loads(data.decode('utf8')) for data in chunks]


IObjectSerializer.register(JsonObjectSerializer)


class JsonSerializer(Serializer):

    SERIALIZER_ID = "json"
    """
    ID used as part of the WebSocket subprotocol name to identify the
    serializer with WAMP-over-WebSocket.
    """

    RAWSOCKET_SERIALIZER_ID = 1
    """
    ID used in lower four bits of second octet in RawSocket opening
    handshake identify the serializer with WAMP-over-RawSocket.
    """
コード例 #3
0
ファイル: serializer.py プロジェクト: fengjp/PokerGameServer
                return s

        def unserialize(self, payload):
            """
            Implements :func:`autobahn.wamp.interfaces.IObjectSerializer.unserialize`
            """
            if self._batched:
                chunks = payload.split(b'\30')[:-1]
            else:
                chunks = [payload]
            if len(chunks) == 0:
                raise Exception("batch format error")
            return [_loads(data.decode('utf8')) for data in chunks]


IObjectSerializer.register(JsonObjectSerializer)


class JsonSerializer(Serializer):

    SERIALIZER_ID = "json"
    """
    ID used as part of the WebSocket subprotocol name to identify the
    serializer with WAMP-over-WebSocket.
    """

    RAWSOCKET_SERIALIZER_ID = 1
    """
    ID used in lower four bits of second octet in RawSocket opening
    handshake identify the serializer with WAMP-over-RawSocket.
    """
コード例 #4
0
            return s

    def unserialize(self, payload):
        """
        Implements :func:`autobahn.wamp.interfaces.IObjectSerializer.unserialize`
        """
        if self._batched:
            chunks = payload.split(b'\30')[:-1]
        else:
            chunks = [payload]
        if len(chunks) == 0:
            raise Exception("batch format error")
        return [_loads(data.decode('utf8')) for data in chunks]


IObjectSerializer.register(JsonObjectSerializer)
SERID_TO_OBJSER[JsonObjectSerializer.NAME] = JsonObjectSerializer


class JsonSerializer(Serializer):

    SERIALIZER_ID = u"json"
    """
    ID used as part of the WebSocket subprotocol name to identify the
    serializer with WAMP-over-WebSocket.
    """

    RAWSOCKET_SERIALIZER_ID = 1
    """
    ID used in lower four bits of second octet in RawSocket opening
    handshake identify the serializer with WAMP-over-RawSocket.
コード例 #5
0
ファイル: autowamp.py プロジェクト: JohnDoee/wampyre
        self.protocol.onMessage([opcode] + list(args))

    def realm_allowed(self, realm):
        return True

    def close_session(self):
        self.session_lost()

    def method_uri_allowed(self, method, uri):
        return True


class PythonObjectSerializer:
    NAME = "python"

    def serialize(self, obj):
        return obj

    def unserialize(self, payload):
        return [payload]


IObjectSerializer.register(PythonObjectSerializer)


class PythonSerializer(Serializer):
    SERIALIZER_ID = "python"


ISerializer.register(PythonSerializer)
コード例 #6
0
                return s

        def unserialize(self, payload):
            """
            Implements :func:`autobahn.wamp.interfaces.IObjectSerializer.unserialize`
            """
            if self._batched:
                chunks = payload.split(b'\30')[:-1]
            else:
                chunks = [payload]
            if len(chunks) == 0:
                raise Exception("batch format error")
            return [_loads(data.decode('utf8')) for data in chunks]


IObjectSerializer.register(JsonObjectSerializer)


class JsonSerializer(Serializer):

    SERIALIZER_ID = u"json"
    """
    ID used as part of the WebSocket subprotocol name to identify the
    serializer with WAMP-over-WebSocket.
    """

    RAWSOCKET_SERIALIZER_ID = 1
    """
    ID used in lower four bits of second octet in RawSocket opening
    handshake identify the serializer with WAMP-over-RawSocket.
    """