Merge pull request #109 from waku-org/same-content-topics

feat: use same content topics across examples when possible
This commit is contained in:
fryorcraken.eth 2022-09-20 11:21:21 +10:00 committed by GitHub
commit 875cc36e7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 4 deletions

View File

@ -56,7 +56,7 @@
const textInput = document.getElementById('textInput');
const sendButton = document.getElementById('sendButton');
const ContentTopic = "/light-js/0/message/utf8";
const ContentTopic = "/js-waku-examples/1/chat/utf8";
let messages = []
let unsubscribe;
@ -106,12 +106,14 @@
subscribeButton.onclick = async () => {
unsubscribe = await node.filter.subscribe(callback, [ContentTopic])
unsubscribeButton.disabled = false;
subscribeButton.disabled = true;
}
unsubscribeButton.onclick = async () => {
await unsubscribe();
unsubscribe = undefined
unsubscribeButton.disabled = true;
subscribeButton.disabled = false;
}
sendButton.onclick = async () => {

View File

@ -19,7 +19,7 @@ interface MessageInterface {
styleUrls: ["./messages.component.css"],
})
export class MessagesComponent implements OnInit {
contentTopic: string = `/relay-angular-chat/1/chat/proto`;
contentTopic: string = `/js-waku-examples/1/chat/proto`;
messages: MessageInterface[] = [];
messageCount: number = 0;
waku!: WakuPrivacy;

View File

@ -50,7 +50,7 @@
// Recommendation: `/dapp-name/version/functionality/codec`
// We recommend to use protobuf as codec (`proto`), this demo uses utf-8
// for simplicity's sake.
const contentTopic = '/relay-demo/1/message/utf-8';
const contentTopic = '/js-waku-examples/1/chat/utf8';
try {
statusDiv.innerHTML = '<p>Starting</p>';

View File

@ -4,7 +4,7 @@ import protobuf from "protobufjs";
import { createPrivacyNode } from "js-waku/lib/create_waku";
import { waitForRemotePeer } from "js-waku/lib/wait_for_remote_peer";
const ContentTopic = `/relay-reactjs-chat/1/chat/proto`;
const ContentTopic = `/js-waku-examples/1/chat/proto`;
const SimpleChatMessage = new protobuf.Type("SimpleChatMessage")
.add(new protobuf.Field("timestamp", 1, "uint32"))