ssbc / ssb-blobs

blob gossiping ssb-subprotocol
MIT License
12 stars 11 forks source link

ssb-blobs methods via RPC #8

Closed nichoth closed 5 years ago

nichoth commented 5 years ago

Hey, I wasn't sure where to put this, but it looks like the blobs.add call is not working over an RPC connection. The context where i found this was calling sbot from a browser via websockets with muxrpc. I made a test that demonstrates this using muxrpc in-process though, not over a socket.

I'm guess that muxrpc does not support this call signature — .add is a function that returns a sink and takes a callback.

This is the failing test: https://github.com/nichoth/eventualism/blob/5ea049a6961176bf7e3a04882473f0fbf6176c58/test/rpc.js#L42

Then this test has the same operation, but using a direct (not rpc) call to sbot, and this works ok: https://github.com/nichoth/eventualism/blob/5ea049a6961176bf7e3a04882473f0fbf6176c58/test/index.js

I did some looking around in the muxrpc source, but couldn't find a solution, so wanted to post this in case anyone knows how to fix this.

dominictarr commented 5 years ago

oh yeah - there isn't support currently for sinks with callbacks, and the only thing that needs it is blobs.add. if you are using ssb-client, then it has a special case that handles blobs.add https://github.com/ssbc/ssb-client/blob/master/index.js#L105-L106

It would be possible to add it, since every muxrpc stream is really a duplex stream, so a sink stream could become a duplex stream that sends 0 or 1 packets back. which are then passed to the callback. This is one of those things that I've always ment to do but everything else seems more important.

stale[bot] commented 5 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?