Skip to content

Commit ef64bb6

Browse files
authored
feat: add custom-router example (#138)
adds an example for how to implement a custom router which allows adding and removing protocols at runtime. moved over from n0-computer/iroh#3367
1 parent 8d4176a commit ef64bb6

File tree

6 files changed

+5061
-1
lines changed

6 files changed

+5061
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ env:
1313
RUSTFLAGS: -Dwarnings
1414
RUSTDOCFLAGS: -Dwarnings
1515
MSRV: "1.81"
16-
RS_EXAMPLES_LIST: "dumbpipe-web,extism/host,extism/iroh-extism-host-functions,extism/plugin,iroh-automerge,iroh-automerge-repo,iroh-gateway,frosty,browser-echo,framed-messages"
16+
RS_EXAMPLES_LIST: "dumbpipe-web,extism/host,extism/iroh-extism-host-functions,extism/plugin,iroh-automerge,iroh-automerge-repo,iroh-gateway,frosty,browser-echo,framed-messages,custom-router"
1717
WASM_EXAMPLES_LIST: "browser-echo"
1818
IROH_FORCE_STAGING_RELAYS: "1"
1919

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ Use iroh in the browser, compiled to web assembly. [Try it here!](https://n0-com
1616
A chat app based on iroh-gossip that can run both in the browser and on the command line.
1717
[Try it here!](https://n0-computer.github.io/iroh-examples/main/browser-chat/index.html)
1818

19+
### [custom-router](custom-router)
20+
21+
When you need more control or customizations than the
22+
[iroh `Router`](https://docs.rs/iroh/latest/iroh/protocol/struct.Router.html) allows, we
23+
recommend to build your own router instead. This example implements a router that allows
24+
to add and remove protocols at runtime.
25+
1926
### [dumbpipe-web](dumbpipe-web)
2027

2128
Forward http requests to dumbpipe. Share a local dev server publicly.

0 commit comments

Comments
 (0)