Skip to content

Commit

Permalink
manually dial peers; fix canvas
Browse files Browse the repository at this point in the history
  • Loading branch information
d-roak committed Oct 5, 2024
1 parent 23d0718 commit 5ade94c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
4 changes: 2 additions & 2 deletions examples/canvas/src/objects/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ export class Canvas implements CRO {
if (!op.value) continue;
switch (op.type) {
case "splash": {
const [nodeId, offset, size, rgb] = op.value;
const [offset, size, rgb] = op.value;
this._splash(offset, size, rgb);
break;
}
case "paint": {
const [nodeId, offset, rgb] = op.value;
const [offset, rgb] = op.value;
this._paint(offset, rgb);
break;
}
Expand Down
13 changes: 9 additions & 4 deletions packages/network/src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ export class TopologyNetworkNode {
list: this._config?.bootstrap_peers
? this._config.bootstrap_peers
: [
"/dns4/relay.droak.sh/tcp/443/wss/p2p/Qma3GsJmB47xYuyahPZPSadh1avvxfyYQwk8R3UnFrQ6aP",
],
"/dns4/relay.droak.sh/tcp/443/wss/p2p/Qma3GsJmB47xYuyahPZPSadh1avvxfyYQwk8R3UnFrQ6aP",
],
}),
],
services: {
Expand Down Expand Up @@ -132,8 +132,13 @@ export class TopologyNetworkNode {
this._node.addEventListener("peer:connect", (e) =>
console.log("::start::peer::connect", e.detail),
);
this._node.addEventListener("peer:discovery", (e) =>
console.log("::start::peer::discovery", e.detail),
this._node.addEventListener("peer:discovery", (e) => {
// current bug in v11.0.0 requires manual dial (https://github.com/libp2p/js-libp2p-pubsub-peer-discovery/issues/149)
for (const ma of e.detail.multiaddrs) {
this._node?.dial(ma)
}
console.log("::start::peer::discovery", e.detail)
}
);
this._node.addEventListener("peer:identify", (e) =>
console.log("::start::peer::identify", e.detail),
Expand Down

0 comments on commit 5ade94c

Please sign in to comment.