add support for multiple remote peers
This commit is contained in:
parent
415faab105
commit
e436bd542e
|
@ -26,7 +26,7 @@ async function runApp(ui) {
|
||||||
ui.setStatus("connected", "success");
|
ui.setStatus("connected", "success");
|
||||||
|
|
||||||
ui.setLocalPeer(info.localPeerId);
|
ui.setLocalPeer(info.localPeerId);
|
||||||
ui.setRemotePeer(info.remotePeerId);
|
ui.setRemotePeer(info.remotePeerIds);
|
||||||
ui.setRemoteMultiAddr(info.multiAddr);
|
ui.setRemoteMultiAddr(info.multiAddr);
|
||||||
ui.setContentTopic(info.contentTopic);
|
ui.setContentTopic(info.contentTopic);
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ async function initWakuContext({
|
||||||
const localPeerId = node.libp2p.peerId.toString();
|
const localPeerId = node.libp2p.peerId.toString();
|
||||||
|
|
||||||
const remotePeers = await node.libp2p.peerStore.all();
|
const remotePeers = await node.libp2p.peerStore.all();
|
||||||
const remotePeerId = remotePeers[0].id.toString();
|
const remotePeerIds = remotePeers.map(peer => peer.id.toString());
|
||||||
|
|
||||||
return {
|
return {
|
||||||
unsubscribeFromMessages,
|
unsubscribeFromMessages,
|
||||||
|
@ -79,7 +79,7 @@ async function initWakuContext({
|
||||||
multiAddr,
|
multiAddr,
|
||||||
contentTopic,
|
contentTopic,
|
||||||
localPeerId,
|
localPeerId,
|
||||||
remotePeerId,
|
remotePeerIds,
|
||||||
},
|
},
|
||||||
sendMessage: async ({ text, nick }) => {
|
sendMessage: async ({ text, nick }) => {
|
||||||
if (!text || !nick) {
|
if (!text || !nick) {
|
||||||
|
@ -136,8 +136,8 @@ function initUI() {
|
||||||
setLocalPeer: (id) => {
|
setLocalPeer: (id) => {
|
||||||
localPeerBlock.innerText = id.toString();
|
localPeerBlock.innerText = id.toString();
|
||||||
},
|
},
|
||||||
setRemotePeer: (id) => {
|
setRemotePeer: (ids) => {
|
||||||
remotePeerId.innerText = id.toString();
|
remotePeerId.innerText = ids.join("\n");
|
||||||
},
|
},
|
||||||
setRemoteMultiAddr: (multiAddr) => {
|
setRemoteMultiAddr: (multiAddr) => {
|
||||||
remoteMultiAddr.innerText = multiAddr.toString();
|
remoteMultiAddr.innerText = multiAddr.toString();
|
||||||
|
|
Loading…
Reference in New Issue