mirror of
https://github.com/logos-messaging/docs.waku.org.git
synced 2026-01-07 15:23:07 +00:00
1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
|
|
"use strict";(self.webpackChunkwaku_guide=self.webpackChunkwaku_guide||[]).push([[4338],{1664:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>i,default:()=>h,frontMatter:()=>a,metadata:()=>t,toc:()=>d});const t=JSON.parse('{"id":"build/javascript/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/build/javascript/light-send-receive.md","sourceDirName":"build/javascript","slug":"/build/javascript/light-send-receive","permalink":"/build/javascript/light-send-receive","draft":false,"unlisted":false,"editUrl":"https://github.com/waku-org/docs.waku.org/tree/develop/docs/build/javascript/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,"displayed_sidebar":"build"},"sidebar":"build","previous":{"title":"Send and Receive Messages in a Reliable Channel","permalink":"/build/javascript/reliable-channels"},"next":{"title":"Retrieve Messages Using Store Protocol","permalink":"/build/javascript/store-retrieve-messages"}}');var o=s(74848),r=s(28453);const a={title:"Send and Receive Messages Using Light Push and Filter",hide_table_of_contents:!0,displayed_sidebar:"build"},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 n={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)(n.p,{children:["This guide provides detailed steps to start using the ",(0,o.jsx)(n.code,{children:"@waku/sdk"})," package by setting up a ",(0,o.jsx)(n.a,{href:"/learn/glossary#light-node",children:"Light Node"})," to send messages using the ",(0,o.jsx)(n.a,{href:"/learn/concepts/protocols#light-push",children:"Light Push protocol"}),", and receive messages using the ",(0,o.jsx)(n.a,{href:"/learn/concepts/protocols#filter",children:"Filter protocol"}),". Have a look at the ",(0,o.jsx)(n.a,{href:"/build/javascript/#installation",children:"installation guide"})," for steps on adding ",(0,o.jsx)(n.code,{children:"@waku/sdk"})," to your project."]}),"\n",(0,o.jsx)(n.h2,{id:"create-a-light-node",children:"Create a light node"}),"\n",(0,o.jsxs)(n.p,{children:["Use the ",(0,o.jsx)(n.code,{children:"createLightNode()"})," function to create a ",(0,o.jsx)(n.a,{href:"/learn/glossary#light-node",children:"Light Node"})," and interact with the Waku Network:"]}),"\n",(0,o.jsx)(n.pre,{children:(0,o.jsx)(n.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)(n.admonition,{type:"info",children:(0,o.jsxs)(n.p,{children:["When the ",(0,o.jsx)(n.code,{children:"defaultBootstrap"})," parameter is set to ",(0,o.jsx)(n.code,{children:"true"}),", your node will be bootstrapped using the ",(0,o.jsx)(n.a,{href:"/build/javascript/configure-discovery#default-bootstrap-method",children:"default bootstrap method"}),". Have a look at the ",(0,o.jsx)(n.a,{href:"/build/javascript/configure-discovery",children:"Bootstrap Nodes and Disco
|