docs.rs failed to build agentlink-wasm-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
AgentLink SDK WASM
WebAssembly bindings for AgentLink SDK, enabling usage in browsers and Node.js.
Building
# Build the WASM target
# Generate JavaScript/TypeScript bindings
Usage
In a Web Application
AgentLink SDK WASM Demo
In Node.js
Use --target bundler or --target nodejs when running wasm-bindgen:
const = require;
console.log;
const client = ;
// ... use the client
API
JsHttpClient
new JsHttpClient(baseUrl: string)- Create a new HTTP clientsetAuthToken(token: string)- Set authentication tokengetAuthToken(): string | undefined- Get current auth tokenget(path: string): Promise<any>- Perform GET requestpost(path: string, body: any): Promise<any>- Perform POST requestput(path: string, body: any): Promise<any>- Perform PUT requestdelete(path: string): Promise<any>- Perform DELETE request
JsMqttClient
new JsMqttClient()- Create a new MQTT clientconnect(brokerUrl: string, clientId: string, username?: string): Promise<void>- Connect to brokerdisconnect(): Promise<void>- Disconnect from brokersubscribe(topic: string, qos: number): Promise<void>- Subscribe to topicunsubscribe(topic: string): Promise<void>- Unsubscribe from topicpublish(topic: string, payload: Uint8Array, qos: number): Promise<void>- Publish messagegetConnectionState(): string- Get connection stateonEvent(callback: Function)- Set event callback
Functions
init()- Initialize the SDK (sets up panic hook and logger)getVersion(): string- Get SDK versionloginWithEmailCode(baseUrl: string, email: string, code: string): Promise<any>- Login helper
Features
- ✅ HTTP Client using Fetch API
- ✅ MQTT Client using WebSocket
- ✅ TypeScript definitions included
- ✅ Async/Promise-based API
- ✅ Event callbacks for MQTT
Notes
- The MQTT client uses WebSocket connections (ws:// or wss://)
- MQTT URLs are automatically converted:
mqtt://→ws://,mqtts://→wss:// - The SDK requires a modern browser with WebAssembly support