<titledata-rh="true">JavaScript Waku SDK | Waku Documentation</title><metadata-rh="true"name="viewport"content="width=device-width,initial-scale=1"><metadata-rh="true"name="twitter:card"content="summary_large_image"><metadata-rh="true"property="og:url"content="https://docs.waku.org/build/javascript/"><metadata-rh="true"property="og:locale"content="en_GB"><metadata-rh="true"name="docusaurus_locale"content="en-GB"><metadata-rh="true"name="docsearch:language"content="en-GB"><metadata-rh="true"name="keywords"content="waku, web3"><metadata-rh="true"name="image"content="https://docs.waku.org/_og/203fde46fe6fb7ea6b5fff00b4498d719dab9c21.png"><metadata-rh="true"name="docusaurus_version"content="current"><metadata-rh="true"name="docusaurus_tag"content="docs-default-current"><metadata-rh="true"name="docsearch:version"content="current"><metadata-rh="true"name="docsearch:docusaurus_tag"content="docs-default-current"><metadata-rh="true"property="og:title"content="JavaScript Waku SDK | Waku Documentation"><metadata-rh="true"name="description"content="Currently, the JavaScript Waku SDK (@waku/sdk) is NOT compatible with React Native. We plan to add support for React Native in the future."><metadata-rh="true"property="og:description"content="Currently, the JavaScript Waku SDK (@waku/sdk) is NOT compatible with React Native. We plan to add support for React Native in the future."><linkdata-rh="true"rel="icon"href="/theme/image/favicon.ico"><linkdata-rh="true"rel="canonical"href="https://docs.waku.org/build/javascript/"><linkdata-rh="true"rel="alternate"href="https://docs.waku.org/build/javascript/"hreflang="en-GB"><linkdata-rh="true"rel="alternate"href="https://docs.waku.org/build/javascript/"hreflang="x-default"><linkrel="alternate icon"type="image/png"href="/theme/image/favicon.png">
<p>The <ahref="https://github.com/waku-org/js-waku"target="_blank"rel="noopener noreferrer">JavaScript Waku SDK</a> (<code>@waku/sdk</code>) provides a TypeScript implementation of the <ahref="/">Waku protocol</a> designed for web browser environments. Developers can seamlessly integrate Waku functionalities into web applications, enabling efficient communication and collaboration among users using the <code>@waku/sdk</code> package.</p>
<h2class="anchor anchorWithHideOnScrollNavbar_WYt5"id="video-tutorials">Video Tutorials<ahref="#video-tutorials"class="hash-link"aria-label="Direct link to Video Tutorials"title="Direct link to Video Tutorials"></a></h2>
<divclass="video-container"><iframeclass="yt-video two-items"src="https://www.youtube.com/embed/PYQaXCxUCwA"title="Waku Tutorial 001: Introduction to Waku"frameborder="0"allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"></iframe><iframeclass="yt-video two-items"src="https://www.youtube.com/embed/sfmMcrbiX0c"title="Build a game using Waku Protocol"frameborder="0"allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"></iframe></div>
<h2class="anchor anchorWithHideOnScrollNavbar_WYt5"id="installation">Installation<ahref="#installation"class="hash-link"aria-label="Direct link to Installation"title="Direct link to Installation"></a></h2>
<p>Install the <code>@waku/sdk</code> package using your preferred package manager:</p>
<h2class="anchor anchorWithHideOnScrollNavbar_WYt5"id="message-structure">Message structure<ahref="#message-structure"class="hash-link"aria-label="Direct link to Message structure"title="Direct link to Message structure"></a></h2>
<p>We recommend creating a message structure for your application using <ahref="https://protobuf.dev/"target="_blank"rel="noopener noreferrer">Protocol Buffers</a> for the following reasons:</p>
<ol>
<li><strong>Consistency:</strong> Ensures uniform message format for easy parsing and processing.</li>
<li><strong>Interoperability:</strong> Facilitates effective communication between different parts of your application.</li>
<li><strong>Compatibility:</strong> Allows smooth communication between older and newer app versions.</li>
<li><strong>Payload Size:</strong> Minimizes payload overhead, especially for byte arrays, unlike JSON which adds significant overhead.</li>
</ol>
<p>To get started, install the <code>protobufjs</code> package using your preferred package manager:</p>
<divclass="language-html codeBlockContainer_EB2s codeBlockContainer_Ckt0 theme-code-block"style="--prism-color:#F8F8F2;--prism-background-color:rgba(var(--lsd-surface-secondary), 0.08)"><divclass="codeBlockContent_QJqH"><pretabindex="0"class="prism-code language-html codeBlock_bY9V thin-scrollbar"style="color:#F8F8F2;background-color:rgba(var(--lsd-surface-secondary), 0.08)"><codeclass="codeBlockLines_e6Vv"><spanclass="token-line"style="color:#F8F8F2"><spanclass="token comment"style="color:rgb(98, 114, 164)"><!-- Or include the protobufjs script --></span><spanclass="token plain"></span><br></span><spanclass="token-line"style="color:#F8F8F2"><spanclass="token plain"></span><spanclass="token tag punctuation"style="color:rgb(248, 248, 242)"><</span><spanclass="token tag"style="color:rgb(255, 121, 198)">script</span><spanclass="token tag"style="color:rgb(255, 121, 198)"></span><spanclass="token tag attr-name"style="color:rgb(241, 250, 140)">src</span><spanclass="token tag attr-value punctuation attr-equals"style="color:rgb(248, 248, 242)">=</span><spanclass="token tag attr-value punctuation"style="color:rgb(248, 248, 242)">"</span><spanclass="token tag attr-value"style="color:rgb(255, 121, 198)">https://cdn.jsdelivr.net/npm/protobufjs@latest/dist/protobuf.min.js</span><spanclass="token tag attr-value punctuation"style="color:rgb(248, 248, 242)">"</span><spanclass="token tag punctuation"style="color:rgb(248, 248, 242)">></span><spanclass="token script"></span><spanclass="token tag punctuation"style="color:rgb(248, 248, 242)"></</span><spanclass="token tag"style="color:rgb(255, 121, 198)">script</span><spanclass="token tag punctuation"style="color:rgb(248, 248, 242)">></span><br></span></code></pre></div></div>
<h2class="anchor anchorWithHideOnScrollNavbar_WYt5"id="getting-started">Getting started<ahref="#getting-started"class="hash-link"aria-label="Direct link to Getting started"title="Direct link to Getting started"></a></h2>
<p>Have a look at the quick start guide and comprehensive tutorials to learn how to build applications using <code>@waku/sdk</code>:</p>
<table><thead><tr><th>Guide</th><th>Description</th></tr></thead><tbody><tr><td><ahref="/build/javascript/reliable-channels">Send and Receive Messages in a Reliable Channel</a></td><td>Learn how to send and receive messages with a convenient SDK that provide various reliable functionalities out-of-the-box.</td></tr><tr><td><ahref="/build/javascript/light-send-receive">Send and Receive Messages Using Light Push and Filter</a></td><td>Learn how to send and receive messages on light nodes using the <ahref="/learn/concepts/protocols#light-push">Light Push</a> and <ahref="/learn/concepts/protocols#filter">Filter</a> protocols</td></tr><tr><td><ahref="/build/javascript/store-retrieve-messages">Retrieve Messages Using Store Protocol</a></td><td>Learn how to retrieve and filter historical messages on light nodes using the <ahref="/learn/concepts/protocols#store">Store protocol</a></td></tr><tr><td><ahref="/build/javascript/message-encryption">Encrypt, Decrypt, and Sign Your Messages</a></td><td>Learn how to use the <ahref="https://www.npmjs.com/package/@waku/message-encryption"target="_blank"rel="noopener noreferrer">@waku/message-encryption</a> package to encrypt, decrypt, and sign your messages</td></tr><tr><td><ahref="/build/javascript/use-waku-react">Build React DApps Using @waku/react</a></td><td>Learn how to use the <ahref="https://www.npmjs.com/package/@waku/react"target="_blank"rel="noopener noreferrer">@waku/react</a> package seamlessly integrate <code>@waku/sdk</code> into a React application</td></tr><tr><td><ahref="/build/javascript/use-waku-create-app">Scaffold DApps Using @waku/create-app</a></td><td>Learn how to use the <ahref="https://www.npmjs.com/package/@waku/create-app"target="_blank"rel="noopener noreferrer">@waku/create-app</a> package to bootstrap your next <code>@waku/sdk</code> project from various example templates</td></tr><tr><td><ahref="/build/javascript/configure-discovery">Bootstrap Nodes and Discover Peers</a></td><td>Learn how to bootstrap your node using <ahref="/learn/concepts/static-peers">Static Peers</a> and discover peers using <ahref="/learn/concepts/dns-discovery">DNS Discovery</a></td></tr><tr><td><ahref="/build/javascript/run-waku-nodejs">Run @waku/sdk in a NodeJS Application</a></td><td>Learn our suggested approach for using the <code>@waku/sdk</code> package within a NodeJS application</td></tr><tr><td><ahref="/build/javascript/debug-waku-dapp">Debug Your Waku DApp and WebSocket</a></td><td>Learn how to troubleshoot your Waku DApp using debug logs and check <ahref="/learn/concepts/transports">WebSocket</a> connections in <ahref="/run-node/">nwaku</a></td></tr><tr><td><ahref="/build/javascript/manage-filter">Manage Your Filter Subscriptions</a></td><td>Learn how to manage <ahref="/learn/concepts/protocols#filter">filter subscriptions</a> and handle node disconnections in your application</td></tr></tbody></table>
<divclass="theme-admonition theme-admonition-tip alert--success admonition_ntHH"><spanclass="admonitionIcon_BGV6"><svgwidth="16"height="16"viewBox="0 0 16 16"xmlns="http://www.w3.org/2000/svg"><pathd="M8 14.6666C7.63333 14.6666 7.31933 14.536 7.058 14.2746C6.79667 14.0133 6.66622 13.6995 6.66667 13.3333H9.33333C9.33333 13.7 9.20267 14.014 8.94133 14.2753C8.68 14.5366 8.36622 14.6671 8 14.6666ZM5.33333 12.6666V11.3333H10.6667V12.6666H5.33333ZM5.5 10.6666C4.73333 10.2111 4.12489 9.59998 3.67467 8.83331C3.22445 8.06665 2.99956 7.23331 3 6.33331C3 4.94442 3.48622 3.76376 4.45867 2.79131C5.43111 1.81887 6.61156 1.33287 8 1.33331C9.38889 1.33331 10.5696 1.81954 11.542 2.79198C12.5144 3.76442 13.0004 4.94487 13 6.33331C13 7.23331 12.7751 8.06665 12.3253 8.83331C11.8756 9.59998 11.2671 10.2111 10.5 10.6666H5.5ZM5.9 9.33331H10.1C10.6 8.97776 10.9862 8.53887 11.2587 8.01665C11.5311 7.49442 11.6671 6.93331 11.6667 6.33331C11.6667 5.31109 11.3111 4.44442 10.6 3.73331C9.88889 3.0222 9.02222 2.66665 8 2.66665C6.97778 2.66665 6.11111 3.0222 5.4 3.73331C4.68889 4.44442 4.33333 5.31109 4.33333 6.33331C4.33333 6.93331 4.46956 7.49442 4.742 8.01665C5.01444 8.53887 5.40045 8.97776 5.9 9.33331Z"fill="currentColor"></path></svg></span><div><spanclass="lsd-typography lsd-typography--body1 admonitionHeading_JPfy">tip</span><spanclass="lsd-typography lsd-typography--body1 admonitionContent_iozl"><p>Until <ahref="/learn/research#prevention-of-denial-of-service-dos-and-node-incentivisation">node incentivisation</a> is in place, you should <ahref="/run-node/">operate extra nodes</a> alongside the ones provided by the Waku Network. When running a node, we recommend using the <ahref="/build/javascript/configure-discovery#configure-dns-discovery-and-static-peers">DNS Discovery and Static Peers</a> configuration to connect to both the Waku Network and your node.</p></span></div></div>
<h2class="anchor anchorWithHideOnScrollNavbar_WYt5"id="get-help-and-report-issues">Get help and report issues<ahref="#get-help-and-report-issues"class="hash-link"aria-label="Direct link to Get help and report issues"title="Direct link to Get help and report issues"></a></h2>
<p>To engage in general discussions, seek assistance, or stay updated with the latest news, visit the <code>#support</code> and <code>#js-waku-contribute</code> channels on the <ahref="https://discord.waku.org"target="_blank"rel="noopener noreferrer">Waku Discord</a>.</p>
<p>If you discover bugs or want to suggest new features, do not hesitate to <ahref="https://github.com/waku-org/js-waku/issues/new/"target="_blank"rel="noopener noreferrer">open an issue</a> in the <ahref="https://github.com/waku-org/js-waku"target="_blank"rel="noopener noreferrer">js-waku repository</a>. Your feedback and contributions are highly valued and will help improve the <code>@waku/sdk</code> package.</p></div><footerclass="theme-doc-footer docusaurus-mt-lg"><divclass="row margin-top--sm theme-doc-footer-edit-meta-row"><divclass="col"><ahref="https://github.com/waku-org/docs.waku.org/tree/develop/docs/build/javascript/index.md"target="_blank"rel="noreferrer noopener"class="theme-edit-this-page"><divclass="icon_S7Kx m_thRi"><svgxmlns="http://www.w3.org/2000/svg"width="16"height="16"fill="none"viewBox="0 0 16 16"><pathfill="#fff"fill-rule="evenodd"d="m12.707 2.393.9.9c.526.52.526 1.367 0 1.887L4.787 14H2v-2.787l6.933-6.94 1.887-1.88c.52-.52 1.367-.52 1.887 0M3.333 12.667l.94.04 6.547-6.554-.94-.94-6.547 6.547z"clip-rule="evenodd"></path></svg></div><spanclass="lsd-typography lsd-typography--body2">Edit this page</span></a></div><divclass="col lastUpdated_JAkA"></div></div></footer></article><navclass="docusaurus-mt-lg pagination-nav"aria-label="Docs pages"><aclass="pagination-nav__link pagination-nav__link--next"href="/build/javascript/reliable-channels"><spanclass="lsd-typography lsd-typography--body2 pagination-nav__label">Send and Receive Messages in a Reliable Channel</span><divclass="icon_S7Kx m_thRi"><svgxmlns="http://www.w3.org/2000/svg"width="14"height="14"fill="none"viewBox="0 0 14 14"><pathfill="#fff"d="m7 2.334-.823.822 3.255 3.26H2.333v1.167h7.1l-3.256 3.261.823.823L11.667 7z"></path></svg></div></a></nav></div></div><divclass="gap1_XuuQ"></div></div></div></main></div></div></div><footerclass="footer"><divclass="container container-fluid firstRow_ar1q"><divclass="footer__bottom text--center"><divclass="margin-bottom--sm"><aclass="footerLogoLink_BH7S"href="/"><imgsrc="/theme/image/logo.svg"alt="Waku"class="themedImage_kfRS themedImage--light_BL8e footer__logo"width="22"><imgsrc="/theme/image/logo.svg"alt="Waku"class="themedImage_kfRS themedImage--dark_OvIx footer__logo"width="22"></a></div><divclass="footer__copyright">Waku</div></div><divclass="row footer__links"><divclass="theme-layout-footer-column col footer__col"><divclass="footer__title">Community</div><ulclass="footer__items clean-list"><liclass="footer__item"><ahref="https://twitter.com/waku_org/"target="_blank"rel="noopener noreferrer"class="footer__link-item">X<svgwidth="13.5"height="13.5"aria-hidden="true"class="iconExternalLink_nPIU"><usehref="#theme-svg-external-link"></use></svg></a></li><liclass="footer__item"><ahref="https://discord.waku.org/"target="_blank"rel="noopener noreferrer"class="footer__link-item">Discord<svgwidth="13.5"height="13.5"aria-hidden="true"class="iconExternalLink_nPIU"><usehref="#theme-svg-external-link"></use></svg></a></li><liclass="footer__item"><ahref="https://github.com/waku-org/"target="_blank"rel="noopener noreferrer"class="footer__link-item">GitHub<svgwidth="13.5"height="13.5"aria-hidden="true"class="iconExternalLink_nPIU"><usehref="#theme-svg-external-link"></use></svg></a></li><liclass="footer__item"><ahref="https://www.youtube.com/@wakuorg"target="_blank"rel="noopener noreferrer"class="footer__link-item">YouTube<svgwidth="13.5"height="13.5"aria-hidden="true"class="iconExternalLink_nPIU"><usehref="#theme-svg-external-link"></use></svg></a></li><liclass="footer__item"><ahref="https://www.linkedin.com/company/waku-org"target="_blank"rel="noopener noreferrer"class="footer__link-item">LinkedIn<svgwidth="13.5"height="13.5"aria-hidden="true"class="iconExternalLink_nPIU"><usehref="#theme-svg-external-link"></use></svg></a></li><liclass="footer__item"><ahref="https://warpcast.com/waku"target="_blank"rel="noopener noreferrer"class="footer__link-item">Farcaster<svgwidth="13.5"height="13.5"aria-hidden