docs.waku.org/assets/js/c57f3997.997cbe1f.js

1 line
13 KiB
JavaScript
Raw Normal View History

2025-09-29 05:17:21 +00:00
"use strict";(self.webpackChunkwaku_guide=self.webpackChunkwaku_guide||[]).push([[732],{28453:(e,s,n)=>{n.d(s,{R:()=>a,x:()=>i});var t=n(96540);const o={},r=t.createContext(o);function a(e){const s=t.useContext(r);return t.useMemo(function(){return"function"==typeof e?e(s):{...s,...e}},[s,e])}function i(e){let s;return s=e.disableParentContext?"function"==typeof e.components?e.components(o):e.components||o:a(e.components),t.createElement(r.Provider,{value:s},e.children)}},88839:(e,s,n)=>{n.r(s),n.d(s,{assets:()=>c,contentTitle:()=>i,default:()=>h,frontMatter:()=>a,metadata:()=>t,toc:()=>d});const t=JSON.parse('{"id":"guides/js-waku/light-send-receive","title":"Send and Receive Messages Using Light Push and Filter","description":"This guide provides detailed steps to start using the @waku/sdk package by setting up a Light Node to send messages using the Light Push protocol, and receive messages using the Filter protocol. Have a look at the installation guide for steps on adding @waku/sdk to your project.","source":"@site/docs/guides/js-waku/light-send-receive.md","sourceDirName":"guides/js-waku","slug":"/guides/js-waku/light-send-receive","permalink":"/guides/js-waku/light-send-receive","draft":false,"unlisted":false,"editUrl":"https://github.com/waku-org/docs.waku.org/tree/develop/docs/guides/js-waku/light-send-receive.md","tags":[],"version":"current","lastUpdatedAt":null,"frontMatter":{"title":"Send and Receive Messages Using Light Push and Filter","hide_table_of_contents":true},"sidebar":"guides","previous":{"title":"Send and Receive Messages in a Reliable Channel","permalink":"/guides/js-waku/reliable-channels"},"next":{"title":"Retrieve Messages Using Store Protocol","permalink":"/guides/js-waku/store-retrieve-messages"}}');var o=n(74848),r=n(28453);const a={title:"Send and Receive Messages Using Light Push and Filter",hide_table_of_contents:!0},i=void 0,c={},d=[{value:"Create a light node",id:"create-a-light-node",level:2},{value:"Alternative network configuration",id:"alternative-network-configuration",level:3},{value:"Connect to remote peers",id:"connect-to-remote-peers",level:2},{value:"Choose a content topic",id:"choose-a-content-topic",level:2},{value:"Create a message structure",id:"create-a-message-structure",level:2},{value:"Send messages using light push",id:"send-messages-using-light-push",level:2},{value:"Receive messages using filter",id:"receive-messages-using-filter",level:2}];function l(e){const s={a:"a",admonition:"admonition",code:"code",h2:"h2",h3:"h3",p:"p",pre:"pre",strong:"strong",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(s.p,{children:["This guide provides detailed steps to start using the ",(0,o.jsx)(s.code,{children:"@waku/sdk"})," package by setting up a ",(0,o.jsx)(s.a,{href:"/learn/glossary#light-node",children:"Light Node"})," to send messages using the ",(0,o.jsx)(s.a,{href:"/learn/concepts/protocols#light-push",children:"Light Push protocol"}),", and receive messages using the ",(0,o.jsx)(s.a,{href:"/learn/concepts/protocols#filter",children:"Filter protocol"}),". Have a look at the ",(0,o.jsx)(s.a,{href:"/guides/js-waku/#installation",children:"installation guide"})," for steps on adding ",(0,o.jsx)(s.code,{children:"@waku/sdk"})," to your project."]}),"\n",(0,o.jsx)(s.h2,{id:"create-a-light-node",children:"Create a light node"}),"\n",(0,o.jsxs)(s.p,{children:["Use the ",(0,o.jsx)(s.code,{children:"createLightNode()"})," function to create a ",(0,o.jsx)(s.a,{href:"/learn/glossary#light-node",children:"Light Node"})," and interact with the Waku Network:"]}),"\n",(0,o.jsx)(s.pre,{children:(0,o.jsx)(s.code,{className:"language-js",children:'import { createLightNode } from "@waku/sdk";\n\n// Create and start a Light Node\nconst node = await createLightNode({ defaultBootstrap: true });\nawait node.start();\n\n// Use the stop() function to stop a running node\n// await node.stop();\n'})}),"\n",(0,o.jsx)(s.admonition,{type:"info",children:(0,o.jsxs)(s.p,{children:["When the ",(0,o.jsx)(s.code,{children:"defaultBootstrap"})," parameter is set to ",(0,o.j