@enclave-vm/client package - the client SDK for EnclaveJS.
Installation
EnclaveClient Class
The main client class for connecting to EnclaveJS brokers.Constructor
ClientOptions
| Property | Type | Default | Description |
|---|---|---|---|
serverUrl | string | Required | Broker URL |
timeout | number | 30000 | Request timeout in ms |
auth | AuthOptions | undefined | Authentication config |
reconnection | ReconnectionOptions | undefined | Reconnection config |
encryption | EncryptionOptions | undefined | E2E encryption config |
AuthOptions
ReconnectionOptions
EncryptionOptions
Methods
execute(code, options?)
Execute code with streaming response.executeWithToolHandler(code, toolHandler, options?)
Execute with automatic tool handling.getSession(sessionId)
Get session information.submitToolResult(sessionId, callId, result)
Submit a tool result.health()
Check broker health.Event Handling
Event Types
Processing Events
Cancellation
Using AbortController
Authentication
Bearer Token
Dynamic Token
API Key
Encryption
Enable E2E Encryption
Reconnection
Automatic Reconnection
Error Handling
Complete Example
Browser Usage
Related
- Client Overview - Usage guide
- @enclave-vm/types - Type definitions
- @enclave-vm/react - React hooks