diff --git a/docs/guides/js-waku/debug-waku-dapp.md b/docs/guides/js-waku/debug-waku-dapp.md index aca2764..eb982e8 100644 --- a/docs/guides/js-waku/debug-waku-dapp.md +++ b/docs/guides/js-waku/debug-waku-dapp.md @@ -32,8 +32,9 @@ export DEBUG=* To view debug logs in your browser's console, modify the local storage and add the `debug` key. Here are guides for various modern browsers: -- [Firefox](https://firefox-source-docs.mozilla.org/devtools-user/storage_inspector/local_storage_session_storage/index.html) - [Google Chrome](https://developer.chrome.com/docs/devtools/storage/localstorage/) +- [Firefox](https://firefox-source-docs.mozilla.org/devtools-user/storage_inspector/local_storage_session_storage/index.html) +- [JavaScript](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) | KEY | VALUE | DESCRIPTION | | - | - | - | @@ -47,14 +48,10 @@ To view debug logs in your browser's console, modify the local storage and add t It's important to note that browsers impose certain limitations on WebSocket usage: -- **Secure Context Requirement**: Insecure subroutines are prohibited in secure contexts. This means that on an `https://` webpage, only `wss` connections are permitted, while `ws` connections are not allowed. +- **Secure Context Requirement**: Insecure subroutines are prohibited in secure contexts. On an `https://` webpage, only `wss` connections are permitted, while `ws` connections are not allowed. This restriction does not apply if the webpage is served locally, like on `localhost` or `127.0.0.1`. - **Certificate Validation**: Certificate validation rules are consistent for `https` and `wss` connections. Certificates must not be expired, issued by a recognized Certificate Authority (CA), and match the domain name, among other criteria. - **User Feedback on Errors**: Web browsers do not display errors related to subroutines to the user. If a WebSocket connection encounters an issue, users won't be alerted directly; you'll need to check the browser's console for error details. -:::info -The mentioned restrictions are not applicable if the webpage is served locally, like on `localhost` or `127.0.0.1`. -::: - If you encounter difficulties when connecting to a remote node using `wss`, follow these steps: ### Try Websocat for Connection diff --git a/docs/guides/js-waku/index.md b/docs/guides/js-waku/index.md index 16764a1..4a4d652 100644 --- a/docs/guides/js-waku/index.md +++ b/docs/guides/js-waku/index.md @@ -43,6 +43,7 @@ We recommend creating a message structure for your application using [Protocol B 1. **Consistency:** Ensures uniform message format for easy parsing and processing. 2. **Interoperability:** Facilitates effective communication between different parts of your application. 3. **Compatibility:** Allows smooth communication between older and newer app versions. +4. **Payload Size:** Minimizes payload overhead, especially for byte arrays, unlike JSON which adds significant overhead. To get started, install the `protobufjs` package using your preferred package manager: diff --git a/docs/guides/js-waku/run-waku-nodejs.md b/docs/guides/js-waku/run-waku-nodejs.md index f5ead04..9336309 100644 --- a/docs/guides/js-waku/run-waku-nodejs.md +++ b/docs/guides/js-waku/run-waku-nodejs.md @@ -16,19 +16,17 @@ While the `@waku/sdk` package is primarily designed for browser environments, yo ### Codebase Complexity -Balancing browser and NodeJS compatibility while maintaining simplicity adds complexity. A potential fix is making a NodeJS package that wraps `@waku/sdk` for smoother NodeJS development. +`@waku/sdk` aims to provide optimal default for the browser, striking a balance between browser and NodeJS compatibility while ensuring simplicity will add complexity. -### Browser-Specific Logic +### Browser-Specific Protocols -Certain features in `@waku/sdk` are tailored for browsers and might not translate seamlessly to NodeJS. For example, [Relay protocol](/overview/concepts/protocols#relay) in browsers requires unique [transport methods](/overview/concepts/transports) such as `WebTransport` or `WebRTC`, which might not align with NodeJS networking capabilities. - -### Peer Management +Certain features in `@waku/sdk` are tailored for browsers and might not translate seamlessly to NodeJS. For example, only `WebSocket` is supported in the browser, whereas a NodeJS application can benefit from using [transport methods](/overview/concepts/transports) like `TCP`. `@waku/sdk` default peer management caters to the browser's ephemeral nature, which is different for NodeJS. This is why [DNS Discovery](/overview/concepts/dns-discovery) and [Peer Exchange](/overview/concepts/peer-exchange) are the default discovery mechanisms for the browser but not for NodeJS and desktop applications. ## Recommendations -Considering these limitations, consider your use case before opting for `@waku/sdk` in NodeJS. For a more optimised solution, we recommend [running nwaku in a Docker container](/guides/nwaku/run-docker) and consuming its [JSON RPC API](https://rfc.vac.dev/spec/16/). +Before using `@waku/sdk` in a NodeJS environment, take into account these limitations. For a more optimised solution, we recommend [running nwaku in a Docker container](/guides/nwaku/run-docker) and consuming its [JSON RPC API](https://rfc.vac.dev/spec/16/). ## Future Developments