Apparently working sink handler
This commit is contained in:
parent
e2e893018b
commit
02f50239fc
@ -22,8 +22,8 @@ class MuxRPCSourceHandler(object):
|
||||
|
||||
class MuxRPCSinkHandlerMixin(object):
|
||||
|
||||
def send(self, msg, msg_type=PSMessageType.JSON):
|
||||
self.connection.send(msg, stream=True, msg_type=msg_type, req=self.req)
|
||||
def send(self, msg, msg_type=PSMessageType.JSON, end=False):
|
||||
self.connection.send(msg, stream=True, msg_type=msg_type, req=self.req, end_err=end)
|
||||
|
||||
|
||||
class MuxRPCDuplexHandler(MuxRPCSinkHandlerMixin, MuxRPCSourceHandler):
|
||||
|
@ -47,7 +47,12 @@ async def main():
|
||||
handler.send(struct.pack('l', int(time.time() * 1000)), msg_type=PSMessageType.BUFFER)
|
||||
async for msg in handler:
|
||||
print('> RESPONSE:', msg)
|
||||
handler.send(True, end=True)
|
||||
break
|
||||
|
||||
handler = api.call('blobs.add', [], 'sink')
|
||||
handler.send(b'dead0beef', msg_type=PSMessageType.BUFFER)
|
||||
handler.send(True, end=True)
|
||||
|
||||
# create console handler and set level to debug
|
||||
ch = logging.StreamHandler()
|
||||
|
Loading…
Reference in New Issue
Block a user