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. """
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. """
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.
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)