mirror of
https://github.com/logos-messaging/examples.waku.org.git
synced 2026-01-05 22:33:08 +00:00
Updates
This commit is contained in:
parent
6b98c0c3cf
commit
e50891caff
@ -39,12 +39,12 @@
|
|||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import * as utils from "https://unpkg.com/@waku/byte-utils@0.0.2/bundle/index.js";
|
import * as utils from "https://unpkg.com/@waku/byte-utils@0.0.2/bundle/index.js";
|
||||||
import { createLightNode } from "https://unpkg.com/@waku/create@0.0.4/bundle/index.js";
|
import { createLightNode } from "https://unpkg.com/@waku/create@0.0.5/bundle/index.js";
|
||||||
import { waitForRemotePeer } from "https://unpkg.com/@waku/core@0.0.6/bundle/lib/wait_for_remote_peer.js";
|
|
||||||
import {
|
import {
|
||||||
EncoderV0,
|
waitForRemotePeer,
|
||||||
DecoderV0,
|
createEncoder,
|
||||||
} from "https://unpkg.com/@waku/core@0.0.6/bundle/lib/waku_message/version_0.js";
|
createDecoder,
|
||||||
|
} from "https://unpkg.com/@waku/core@0.0.7/bundle/index.js";
|
||||||
|
|
||||||
const peerIdDiv = document.getElementById("peer-id");
|
const peerIdDiv = document.getElementById("peer-id");
|
||||||
const remotePeerIdDiv = document.getElementById("remote-peer-id");
|
const remotePeerIdDiv = document.getElementById("remote-peer-id");
|
||||||
@ -58,8 +58,8 @@
|
|||||||
const sendButton = document.getElementById("sendButton");
|
const sendButton = document.getElementById("sendButton");
|
||||||
|
|
||||||
const ContentTopic = "/js-waku-examples/1/chat/utf8";
|
const ContentTopic = "/js-waku-examples/1/chat/utf8";
|
||||||
const decoder = new DecoderV0(ContentTopic);
|
const decoder = createDecoder(ContentTopic);
|
||||||
const encoder = new EncoderV0(ContentTopic);
|
const encoder = createEncoder(ContentTopic);
|
||||||
let messages = [];
|
let messages = [];
|
||||||
let unsubscribe;
|
let unsubscribe;
|
||||||
|
|
||||||
|
|||||||
@ -34,12 +34,12 @@
|
|||||||
bytesToUtf8,
|
bytesToUtf8,
|
||||||
utf8ToBytes,
|
utf8ToBytes,
|
||||||
} from "https://unpkg.com/@waku/byte-utils@0.0.2/bundle/index.js";
|
} from "https://unpkg.com/@waku/byte-utils@0.0.2/bundle/index.js";
|
||||||
import { createPrivacyNode } from "https://unpkg.com/@waku/create@0.0.4/bundle/index.js";
|
import { createRelayNode } from "https://unpkg.com/@waku/create@0.0.5/bundle/index.js";
|
||||||
import { waitForRemotePeer } from "https://unpkg.com/@waku/core@0.0.6/bundle/lib/wait_for_remote_peer.js";
|
|
||||||
import {
|
import {
|
||||||
DecoderV0,
|
waitForRemotePeer,
|
||||||
EncoderV0,
|
createDecoder,
|
||||||
} from "https://unpkg.com/@waku/core@0.0.6/bundle/lib/waku_message/version_0.js";
|
createEncoder,
|
||||||
|
} from "https://unpkg.com/@waku/core@0.0.7/bundle/index.js";
|
||||||
|
|
||||||
const statusDiv = document.getElementById("status");
|
const statusDiv = document.getElementById("status");
|
||||||
const messagesDiv = document.getElementById("messages");
|
const messagesDiv = document.getElementById("messages");
|
||||||
@ -55,8 +55,8 @@
|
|||||||
|
|
||||||
// Prepare encoder and decoder, `V0` for clear text messages.
|
// Prepare encoder and decoder, `V0` for clear text messages.
|
||||||
|
|
||||||
const encoder = new EncoderV0(contentTopic);
|
const encoder = createEncoder(contentTopic);
|
||||||
const decoder = new DecoderV0(contentTopic);
|
const decoder = createDecoder(contentTopic);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
statusDiv.innerHTML = "<p>Starting</p>";
|
statusDiv.innerHTML = "<p>Starting</p>";
|
||||||
@ -66,7 +66,7 @@
|
|||||||
// We are currently working on migrating this method to DNS Discovery.
|
// We are currently working on migrating this method to DNS Discovery.
|
||||||
//
|
//
|
||||||
// https://js.waku.org/functions/lib_create_waku.createPrivacyNode.html
|
// https://js.waku.org/functions/lib_create_waku.createPrivacyNode.html
|
||||||
const waku = await createPrivacyNode({ defaultBootstrap: true });
|
const waku = await createRelayNode({ defaultBootstrap: true });
|
||||||
await waku.start();
|
await waku.start();
|
||||||
|
|
||||||
// Add a hook to process all incoming messages on a specified content topic.
|
// Add a hook to process all incoming messages on a specified content topic.
|
||||||
|
|||||||
@ -14,13 +14,13 @@
|
|||||||
import {
|
import {
|
||||||
defaultLibp2p,
|
defaultLibp2p,
|
||||||
defaultPeerDiscovery,
|
defaultPeerDiscovery,
|
||||||
} from "https://unpkg.com/@waku/create@0.0.4/bundle/index.js";
|
} from "https://unpkg.com/@waku/create@0.0.5/bundle/index.js";
|
||||||
import { waitForRemotePeer } from "https://unpkg.com/@waku/core@0.0.6/bundle/lib/wait_for_remote_peer.js";
|
|
||||||
import {
|
import {
|
||||||
wakuStore,
|
wakuStore,
|
||||||
WakuNode,
|
WakuNode,
|
||||||
} from "https://unpkg.com/@waku/core@0.0.6/bundle/index.js";
|
waitForRemotePeer,
|
||||||
import { DecoderV0 } from "https://unpkg.com/@waku/core@0.0.6/bundle/lib/waku_message/version_0.js";
|
createDecoder,
|
||||||
|
} from "https://unpkg.com/@waku/core@0.0.7/bundle/index.js";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This example demonstrates how to use the js-waku minified bundle
|
* This example demonstrates how to use the js-waku minified bundle
|
||||||
@ -56,7 +56,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
await node.store.queryOrderedCallback(
|
await node.store.queryOrderedCallback(
|
||||||
[new DecoderV0("/relay-ping/1/ping/null")],
|
[createDecoder("/relay-ping/1/ping/null")],
|
||||||
callback,
|
callback,
|
||||||
{ pageDirection: "backward" }
|
{ pageDirection: "backward" }
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user