diff --git a/docs/guides/js-waku/light-send-receive.md b/docs/guides/js-waku/light-send-receive.md index c695cc1c..2a89d2dc 100644 --- a/docs/guides/js-waku/light-send-receive.md +++ b/docs/guides/js-waku/light-send-receive.md @@ -107,7 +107,7 @@ Create your application's message structure using [Protobuf's valid message](htt import protobuf from "protobufjs"; // Create a message structure using Protobuf -const ChatMessage = new protobuf.Type("ChatMessage") +const DataPacket = new protobuf.Type("DataPacket") .add(new protobuf.Field("timestamp", 1, "uint64")) .add(new protobuf.Field("sender", 2, "string")) .add(new protobuf.Field("message", 3, "string")); @@ -123,14 +123,14 @@ To send messages over the Waku Network using the `Light Push` protocol, create a ```js // Create a new message object -const protoMessage = ChatMessage.create({ +const protoMessage = DataPacket.create({ timestamp: Date.now(), sender: "Alice", message: "Hello, World!", }); // Serialise the message using Protobuf -const serialisedMessage = ChatMessage.encode(protoMessage).finish(); +const serialisedMessage = DataPacket.encode(protoMessage).finish(); // Send the message using Light Push await node.lightPush.send(encoder, { @@ -148,7 +148,7 @@ const callback = (wakuMessage) => { // Check if there is a payload on the message if (!wakuMessage.payload) return; // Render the messageObj as desired in your application - const messageObj = ChatMessage.decode(wakuMessage.payload); + const messageObj = DataPacket.decode(wakuMessage.payload); console.log(messageObj); }; diff --git a/docs/guides/js-waku/use-waku-react.md b/docs/guides/js-waku/use-waku-react.md index 163e14e3..974af9ac 100644 --- a/docs/guides/js-waku/use-waku-react.md +++ b/docs/guides/js-waku/use-waku-react.md @@ -118,7 +118,7 @@ function App() { const decoder = createDecoder(contentTopic); // Create a message structure using Protobuf - const ChatMessage = new protobuf.Type("ChatMessage") + const DataPacket = new protobuf.Type("DataPacket") .add(new protobuf.Field("timestamp", 1, "uint64")) .add(new protobuf.Field("message", 2, "string")); @@ -223,13 +223,13 @@ function App() { // Create a new message object const timestamp = Date.now(); - const protoMessage = ChatMessage.create({ + const protoMessage = DataPacket.create({ timestamp: timestamp, message: inputMessage }); // Serialise the message and push to the network - const payload = ChatMessage.encode(protoMessage).finish(); + const payload = DataPacket.encode(protoMessage).finish(); const { recipients, errors } = await push({ payload, timestamp }); // Check for errors @@ -258,7 +258,7 @@ function App() { useEffect(() => { setMessages(filterMessages.map((wakuMessage) => { if (!wakuMessage.payload) return; - return ChatMessage.decode(wakuMessage.payload); + return DataPacket.decode(wakuMessage.payload); })); }, [filterMessages]); } @@ -283,7 +283,7 @@ function App() { const allMessages = storeMessages.concat(filterMessages); setMessages(allMessages.map((wakuMessage) => { if (!wakuMessage.payload) return; - return ChatMessage.decode(wakuMessage.payload); + return DataPacket.decode(wakuMessage.payload); })); }, [filterMessages, storeMessages]); } @@ -295,4 +295,4 @@ To explore the available Store query options, have a look at the [Retrieve Messa :::tip You have successfully integrated `@waku/sdk` into a React application using the `@waku/react` package. Have a look at the [web-chat](https://github.com/waku-org/js-waku-examples/tree/master/examples/web-chat) example for a working demo and the [Building a Tic-Tac-Toe Game with Waku](https://blog.waku.org/tictactoe-tutorial) tutorial to learn more. -::: \ No newline at end of file +:::