Skip to content

Commit

Permalink
Implementaion V1 , message +header buffering, partial data fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dhananjaysathe committed May 16, 2013
1 parent 0117a51 commit 7059dea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
8 changes: 5 additions & 3 deletions rce-comm/rce/comm/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ def resumeProducing(self):
self._paused = False
while not self._paused:
try:
data = self.protocol._binary_buff.popleft()
msg = data[0] + data[1].getvalue()
WebSocketProtocol.sendMessage(self.protocol, msg, binary=True)
uriBinary, msgURI = self.protocol._binary_buff.popleft()
WebSocketServerProtocol.sendMessage(self, json.dumps(msgURI))
for data in uriBinary:
msg = data[0] + data[1].getvalue()
WebSocketProtocol.sendMessage(self.protocol, msg, binary=True)
except IndexError:
pass

Expand Down
8 changes: 4 additions & 4 deletions rce-comm/rce/comm/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,10 @@ def sendMessage(self, msg):
def send(msg):
binaries, jsonMsg = recursiveBinarySearch(msg)

WebSocketClientProtocol.sendMessage(self, json.dumps(jsonMsg))

for data in binaries:
self._binary_buff.append(data)
if not uriBinary :
WebSocketClientProtocol.sendMessage(self, json.dumps(msgURI))
else:
self._binary_buff.append((uriBinary, msgURI))


if isInIOThread():
Expand Down
8 changes: 4 additions & 4 deletions rce-comm/rce/comm/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,10 @@ def sendMessage(self, msg):
"""
uriBinary, msgURI = recursiveBinarySearch(msg)

WebSocketServerProtocol.sendMessage(self, json.dumps(msgURI))

for binData in uriBinary:
self._binary_buff.append(binData)
if not uriBinary :
WebSocketServerProtocol.sendMessage(self, json.dumps(msgURI))
else:
self._binary_buff.append((uriBinary, msgURI))

def sendDataMessage(self, iTag, clsName, msgID, msg):
""" Callback for Connection object to send a data message to the robot
Expand Down

0 comments on commit 7059dea

Please sign in to comment.