OCapN in Rust with Goblins interop
This is a quick demo of a project I've been working on to bring Spritely Goblins and OCapN to Rust.
If aren't familiar with these technologies, you can learn more about them on their respective websites. The 10000 foot view is OCapN is a protocol that allows you to interact with objects remotely. Think of it like a fancy RPC. Some of the star features of OCapN (and it's implementation in Goblins) are method pipelining and the ability to perform 3 party handoffs. That means Alice has a reference to Bob, she can pass that reference to Carol, and Carol can use it to interact with Bob directly with no middleman.
Demos
goblins <> rust interop
Here we have two chat boxes, one using the rust implementation and other spritely goblins via Hoot, both compiled to WASM.
This example is based on the original browser goblins chat demo. Full source code to be shared later but until then you can get a sense of how this works from the snippet in this gist.
ir0h
iroh provides an ezpz foundation for dial-by-id p2p and fits naturally into ocapn as a "netlayer" (transport layer).
You can try it out in your browser below! Once you create a room, you will be shown an invite link. Open that up in another browser or share it with a friend to start chatting.
Or open it in a new tab: https://goblin-chat-wasm-iroh.tarq.workers.dev/
The chat is happening over n0.computer's relay servers but is encrypted end-to-end. This is due to limitations in the browser implementation of ir0h today but future development may allow real p2p in-browser
There are other ways of getting direct connections going, such as WebTransport with serverCertificateHashes, or WebRTC. We may expand iroh’s browser support to make use of these to try to generate direct connections even when a browser node is involved in the connection.
Source
This library will be released as open source soon. There's a few house keeping items I want to address first and there are some outstanding issues with 3p handoffs and cap identity that need to be addressed.
As of now, most of the plumbing has come together nicely. I've experimented with some higher level abstractions but have not settled on a final design.
If you'd like to chat about the project you can reach me on matrix at @tarq:matrix.org.