* Add `setupStream` to the list of imports and set up stream for `dhtInstance.swarm` when the "setup" event occurs.

This commit is contained in:
Derrick Hammer 2023-04-08 20:17:44 -04:00
parent 5d0d7a52e8
commit 876d56b25a
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 1 deletions

View File

@ -1,7 +1,7 @@
import { addHandler, handleMessage } from "libkmodule";
import type { ActiveQuery } from "libkmodule";
import { createClient, SwarmClient } from "@lumeweb/kernel-swarm-client";
import { RpcNetwork, RpcQueryOptions } from "@lumeweb/rpc-client";
import { RpcNetwork, RpcQueryOptions, setupStream } from "@lumeweb/rpc-client";
import type { RPCRequest, RPCResponse } from "@lumeweb/interface-relay";
onmessage = handleMessage;
@ -98,6 +98,8 @@ async function createNetwork(def = true): Promise<number> {
const id = nextId();
networkInstances.set(id, dhtInstance);
dhtInstance.swarm.on("setup", async (peer: any) => setupStream(peer));
return id;
}