diff --git a/ssb/api.py b/ssb/api.py index cd51929..605609d 100644 --- a/ssb/api.py +++ b/ssb/api.py @@ -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): diff --git a/test_client.py b/test_client.py index 2cb1744..1b6f8b0 100644 --- a/test_client.py +++ b/test_client.py @@ -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()