a70e68c7bd
* Smolmix documentation * Add smolmix docs: landing page, tutorials, and developer page links * Add Exit Gateway services page (NR vs IPR) and link from existing docs * Update auto-generated command and API outputs * Reorg of tutorials and architecture pages * License information + remove TODO from docs.rs visibile comment + reorg readme * Add versions file for doc-wide versioning * Relative -> absolute links * Relative -> absolute links * Update license + add old tutorial code as examples * Streamline smolmix docs * Clippy * Clean up doc comments * Last pass * Add larger file download to list * set new versions * Clippy * Remove blake pin from docs + add version range to root Cargo.toml * Format example logging * Remove crate blocked component * Loose whitespace * Add doc verification script for inline mdx * Formatting * Components regen * Reorg + tighten text * Voicing cohesion pass + remove bloated examples * Voicing cont. * Reduce max download size * Small suggested clarifications * Max/docs voicing consistency (#6769) * Reduce max download size * voicing consistency across docs * New landing order w smolmix * Tweaks * Final tweaks
53 lines
1.6 KiB
Markdown
53 lines
1.6 KiB
Markdown
# WebSocket Client (Standalone)
|
|
|
|
> This client can also be used via the [Rust SDK](../rust) and [Go/C++ FFI](../rust/ffi).
|
|
|
|
The standalone WebSocket client connects to the Nym Mixnet and exposes a WebSocket interface on localhost, allowing applications in any language to send and receive messages through the Mixnet.
|
|
|
|
This is useful if you're building an application in a language other than TypeScript or Rust and cannot use one of the SDKs directly. Your application connects to the local WebSocket, and the client handles Sphinx packet construction, gateway registration, and key management.
|
|
|
|
## Download or compile
|
|
|
|
Pre-built binaries for macOS and Debian-based Linux are available on the [GitHub releases page](https://github.com/nymtech/nym/releases). Look for the `nym-client` binary.
|
|
|
|
To build from source:
|
|
|
|
```bash
|
|
git clone https://github.com/nymtech/nym.git
|
|
cd nym
|
|
cargo build --release -p nym-client
|
|
```
|
|
|
|
The binary will be at `target/release/nym-client`.
|
|
|
|
## Initialise and run
|
|
|
|
```bash
|
|
# Create a new client identity
|
|
./nym-client init --id my-client
|
|
|
|
# Start the client
|
|
./nym-client run --id my-client
|
|
```
|
|
|
|
The client prints its Nym address on startup and opens a WebSocket on `ws://127.0.0.1:1977`.
|
|
|
|
## Sending and receiving
|
|
|
|
Connect to `ws://127.0.0.1:1977` from your application. Messages are JSON-formatted:
|
|
|
|
**Send a message:**
|
|
```json
|
|
{
|
|
"type": "send",
|
|
"message": "hello",
|
|
"recipient": "<recipient-nym-address>"
|
|
}
|
|
```
|
|
|
|
**Receive messages:** The client pushes incoming messages to your WebSocket connection as they arrive through the Mixnet.
|
|
|
|
## Source code
|
|
|
|
The client source is in the [Nym monorepo](https://github.com/nymtech/nym/tree/master/clients/native).
|