more work
This commit is contained in:
@@ -766,6 +766,7 @@ class WebSocketProtocol:
|
||||
if self.trackedTimings:
|
||||
self.trackedTimings.track("onMessage")
|
||||
self._onMessage(payload, self.message_is_binary)
|
||||
|
||||
self.message_data = None
|
||||
|
||||
|
||||
@@ -2290,7 +2291,7 @@ class WebSocketProtocol:
|
||||
if self.send_state not in [WebSocketProtocol.SEND_STATE_MESSAGE_BEGIN, WebSocketProtocol.SEND_STATE_INSIDE_MESSAGE]:
|
||||
raise Exception("WebSocketProtocol.beginMessageFrame invalid in current sending state [%d]" % self.send_state)
|
||||
|
||||
if (not type(length) in [int, long]) or length < 0 or length > 0x7FFFFFFFFFFFFFFF: # 2**63
|
||||
if type(length) != int or length < 0 or length > 0x7FFFFFFFFFFFFFFF: # 2**63
|
||||
raise Exception("invalid value for message frame length")
|
||||
|
||||
self.send_message_frame_length = length
|
||||
|
||||
@@ -27,23 +27,23 @@ from autobahn.websocket.compress import *
|
||||
|
||||
class TesteeServerProtocol(WebSocketServerProtocol):
|
||||
|
||||
def onMessage(self, msg, binary):
|
||||
self.sendMessage(msg, binary)
|
||||
def onMessage(self, payload, isBinary):
|
||||
self.sendMessage(payload, isBinary)
|
||||
|
||||
|
||||
|
||||
class StreamingTesteeServerProtocol(WebSocketServerProtocol):
|
||||
|
||||
def onMessageBegin(self, opcode):
|
||||
WebSocketServerProtocol.onMessageBegin(self, opcode)
|
||||
self.beginMessage(binary = opcode == WebSocketProtocol.MESSAGE_TYPE_BINARY)
|
||||
def onMessageBegin(self, isBinary):
|
||||
WebSocketServerProtocol.onMessageBegin(self, isBinary)
|
||||
self.beginMessage(isBinary)
|
||||
|
||||
def onMessageFrameBegin(self, length, reserved):
|
||||
WebSocketServerProtocol.onMessageFrameBegin(self, length, reserved)
|
||||
def onMessageFrameBegin(self, length):
|
||||
WebSocketServerProtocol.onMessageFrameBegin(self, length)
|
||||
self.beginMessageFrame(length)
|
||||
|
||||
def onMessageFrameData(self, data):
|
||||
self.sendMessageFrameData(data)
|
||||
def onMessageFrameData(self, payload):
|
||||
self.sendMessageFrameData(payload)
|
||||
|
||||
def onMessageFrameEnd(self):
|
||||
pass
|
||||
@@ -55,8 +55,8 @@ class StreamingTesteeServerProtocol(WebSocketServerProtocol):
|
||||
|
||||
class TesteeServerFactory(WebSocketServerFactory):
|
||||
|
||||
protocol = TesteeServerProtocol
|
||||
#protocol = StreamingTesteeServerProtocol
|
||||
#protocol = TesteeServerProtocol
|
||||
protocol = StreamingTesteeServerProtocol
|
||||
|
||||
def __init__(self, url, debug = False, ident = None):
|
||||
if ident is not None:
|
||||
@@ -65,7 +65,7 @@ class TesteeServerFactory(WebSocketServerFactory):
|
||||
server = "AutobahnPython-Asyncio/%s" % autobahn.version
|
||||
WebSocketServerFactory.__init__(self, url, debug = debug, debugCodePaths = debug, server = server)
|
||||
self.setProtocolOptions(failByDrop = False) # spec conformance
|
||||
#self.setProtocolOptions(failByDrop = True) # needed for streaming mode
|
||||
self.setProtocolOptions(failByDrop = True) # needed for streaming mode
|
||||
#self.setProtocolOptions(utf8validateIncoming = False)
|
||||
|
||||
## enable permessage-deflate
|
||||
|
||||
@@ -28,23 +28,23 @@ from autobahn.websocket.compress import *
|
||||
|
||||
class TesteeServerProtocol(WebSocketServerProtocol):
|
||||
|
||||
def onMessage(self, msg, binary):
|
||||
self.sendMessage(msg, binary)
|
||||
def onMessage(self, payload, isBinary):
|
||||
self.sendMessage(payload, isBinary)
|
||||
|
||||
|
||||
|
||||
class StreamingTesteeServerProtocol(WebSocketServerProtocol):
|
||||
|
||||
def onMessageBegin(self, opcode):
|
||||
WebSocketServerProtocol.onMessageBegin(self, opcode)
|
||||
self.beginMessage(binary = opcode == WebSocketProtocol.MESSAGE_TYPE_BINARY)
|
||||
def onMessageBegin(self, isBinary):
|
||||
WebSocketServerProtocol.onMessageBegin(self, isBinary)
|
||||
self.beginMessage(isBinary)
|
||||
|
||||
def onMessageFrameBegin(self, length, reserved):
|
||||
WebSocketServerProtocol.onMessageFrameBegin(self, length, reserved)
|
||||
def onMessageFrameBegin(self, length):
|
||||
WebSocketServerProtocol.onMessageFrameBegin(self, length)
|
||||
self.beginMessageFrame(length)
|
||||
|
||||
def onMessageFrameData(self, data):
|
||||
self.sendMessageFrameData(data)
|
||||
def onMessageFrameData(self, payload):
|
||||
self.sendMessageFrameData(payload)
|
||||
|
||||
def onMessageFrameEnd(self):
|
||||
pass
|
||||
@@ -56,8 +56,8 @@ class StreamingTesteeServerProtocol(WebSocketServerProtocol):
|
||||
|
||||
class TesteeServerFactory(WebSocketServerFactory):
|
||||
|
||||
protocol = TesteeServerProtocol
|
||||
#protocol = StreamingTesteeServerProtocol
|
||||
#protocol = TesteeServerProtocol
|
||||
protocol = StreamingTesteeServerProtocol
|
||||
|
||||
def __init__(self, url, debug = False, ident = None):
|
||||
if ident is not None:
|
||||
@@ -66,7 +66,7 @@ class TesteeServerFactory(WebSocketServerFactory):
|
||||
server = "AutobahnPython-Twisted/%s" % autobahn.version
|
||||
WebSocketServerFactory.__init__(self, url, debug = debug, debugCodePaths = debug, server = server)
|
||||
self.setProtocolOptions(failByDrop = False) # spec conformance
|
||||
#self.setProtocolOptions(failByDrop = True) # needed for streaming mode
|
||||
self.setProtocolOptions(failByDrop = True) # needed for streaming mode
|
||||
#self.setProtocolOptions(utf8validateIncoming = False)
|
||||
|
||||
## enable permessage-deflate
|
||||
|
||||
Reference in New Issue
Block a user