Hi Asa, You'll want to write a wrapper around kj::WebSocket that implements kj::AsyncIoStream. The implementation of read() should call receive() on the WebSocket and then copy message contents into the output buffer, until at least minBytes bytes have been received. You may need to store the leftovers in a temporary buffer for the next read() call. The implementation of write() should delegate to the WebSocket's send() (should be easy).
Then you can pass this AsyncIoStream implementation to TwoPartyServer.accept(). -Kenton On Sat, Sep 22, 2018 at 2:58 PM Asa Hammond <[email protected]> wrote: > Ok, that wasn't so bad. I now have an httpService that supports /healthz > and allows for websocket connections on /ws. Nice! Quite clean. Mostly > just copying around the test code and some spackle. > Now on to making TwoPartyVatNetwork work over it. I suppose I'll use the > AsyncIoStream approach(this websocket will be dedicated to rpc traffic). > More pointers? =) I'll start rooting around for asyncIoStream hacking > examples. Am I wrapping (and replacing) something like doWebSocket? and > passing that to TwoPartyServer.accept() ? > > > > On Fri, Sep 21, 2018 at 2:32 PM Asa Hammond <[email protected]> wrote: > >> Thanks to both of you... I'll see when I can hack forward more on this >> particular line. Looks very nice. >> >> On Fri, Sep 21, 2018 at 1:27 PM Ian Denhardt <[email protected]> wrote: >> >>> Quoting 'Kenton Varda' via Cap'n Proto (2018-09-21 15:36:25) >>> >>> > The canonical Cap'n Proto RPC protocol is not HTTP-based -- Cap'n >>> Proto >>> > messages are written directly to the socket. So, there's no way to >>> add >>> > a /healthz endpoint to the same port as RPC. >>> >>> My take on how to do this: in your HTTP server, accept websocket >>> connections and use the URL/other information from the request to decide >>> what to supply as the capnproto bootstrap interface. >>> >>> You mentioned wanting to be able to save state. I suggest having a look >>> at persistent.capnp. >>> >> -- You received this message because you are subscribed to the Google Groups "Cap'n Proto" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. Visit this group at https://groups.google.com/group/capnproto.
