(feat): redesign WASM module, add TypeScript SDK, migrate to pnpm
Some checks failed
CI / rustfmt (push) Successful in 17s
CI / wasm build (push) Successful in 1m16s
CI / clippy (push) Successful in 1m28s
CI / test (push) Successful in 1m48s
CI / example (push) Successful in 1m31s
CI / duplicate code (push) Failing after 33s
CI / web client (push) Failing after 34s
CI / cargo-machete (push) Successful in 1m18s
CI / cargo-deny (push) Failing after 3m2s
Some checks failed
CI / rustfmt (push) Successful in 17s
CI / wasm build (push) Successful in 1m16s
CI / clippy (push) Successful in 1m28s
CI / test (push) Successful in 1m48s
CI / example (push) Successful in 1m31s
CI / duplicate code (push) Failing after 33s
CI / web client (push) Failing after 34s
CI / cargo-machete (push) Successful in 1m18s
CI / cargo-deny (push) Failing after 3m2s
This commit is contained in:
parent
89a20044a5
commit
5caa1c9d5f
49 changed files with 3717 additions and 1501 deletions
38
README.md
38
README.md
|
|
@ -2,7 +2,43 @@
|
|||
|
||||
MTP is a modular transport protocol built on QUIC. It provides version-negotiable type maps, a binary codec, cryptographic primitives (classical and post-quantum), and host/client connection management with mutual authentication.
|
||||
|
||||
See the area-specific docs for [Native Client](./NATIVE-CLIENT.md), [WASM Client](./WASM-CLIENT.md), and [Host](./NATIVE-HOST.md)
|
||||
See the area-specific docs for [Native Client](./docs/NATIVE-CLIENT.md), [WASM Client](./docs/WASM-CLIENT.md), [Host](./docs/NATIVE-HOST.md), and [Type Maps](./docs/TYPE-MAP.md).
|
||||
|
||||
## Browser SDK
|
||||
|
||||
The JavaScript package is `mtp`:
|
||||
|
||||
```typescript
|
||||
import { MTPClient } from "mtp";
|
||||
import { mtp } from "mtp/vite";
|
||||
```
|
||||
|
||||
Use `mtp` for the SDK-first API, `mtp/raw` for generated WASM bindings, and `mtp/vite` for the Vite integration.
|
||||
|
||||
```typescript
|
||||
// vite.config.ts
|
||||
import { defineConfig } from "vite";
|
||||
import { mtp } from "mtp/vite";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [mtp({ typeMaps: "./type-maps.yaml" })],
|
||||
});
|
||||
```
|
||||
|
||||
```typescript
|
||||
const client = await MTPClient.create({
|
||||
url: "https://localhost:4433",
|
||||
hostPublicKey,
|
||||
credentials,
|
||||
storage,
|
||||
pings: true,
|
||||
logger: (event) => console.log(event),
|
||||
});
|
||||
|
||||
client.subscribe("SomeType", (message) => console.log(message));
|
||||
await client.connectOrRegister();
|
||||
await client.send("SomeType", { value: "hello" });
|
||||
```
|
||||
|
||||
## Getting Started
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue