def run(self, data): try: obj, i = streamingjson.read(data) mailbox.send(obj) except: mailbox.send(data) return ''
def recv(self, data): # try to stream-decode received data try: while len(data) > 0: res, i = streamingjson.read(data) self.recv_queue.append(res) data = data[i:].lstrip() except: # incomplete data... pass return data
def recv(self): self.recvbuff = TCPClient.recv(self) # try to stream-decode received data try: if len(self.recvbuff) > 0: res, i = streamingjson.read(self.recvbuff) self.recvbuff = self.recvbuff[i:].lstrip() return res except: # incomplete data... pass return None