-
Notifications
You must be signed in to change notification settings - Fork 41
Client SDK TypeScript
Dmitrii Karataev edited this page Feb 26, 2026
·
3 revisions
The rocketride TypeScript SDK provides a full-featured client for connecting to RocketRide Engine, executing pipelines, sending data, and chatting with AI.
From npm:
npm install rocketrideOr download directly from a running engine:
GET http://<engine-host>:<port>/client/typescript
import { RocketRideClient, Question } from 'rocketride';
const client = new RocketRideClient({
uri: 'http://localhost:5565',
auth: 'your-api-key',
});
await client.connect();
const result = await client.use({ filepath: 'pipeline.json' });
const question = new Question();
question.addQuestion('Summarize this document');
const answer = await client.chat({
token: result.token,
question: question,
});
console.log(answer);
await client.disconnect();new RocketRideClient(config: RocketRideClientConfig)| Parameter | Type | Default | Description |
|---|---|---|---|
auth |
string |
ROCKETRIDE_APIKEY env |
API key for authentication |
uri |
string |
ROCKETRIDE_URI env |
Server URI (http/https/ws/wss) |
env |
Record<string, string> |
.env file |
Environment variables for config and pipeline substitution |
persist |
boolean |
false |
Enable automatic reconnection with exponential backoff |
requestTimeout |
number |
none | Default timeout (ms) for individual requests |
maxRetryTime |
number |
none | Max total time (ms) to keep retrying connections |
module |
string |
none | Custom module name for client identification |
onEvent |
EventCallback |
none | Callback for server events |
onConnected |
ConnectCallback |
none | Callback when connection is established |
onDisconnected |
DisconnectCallback |
none | Callback when connection is lost |
onConnectError |
ConnectErrorCallback |
none | Callback on connection error |
HTTP/HTTPS URIs are automatically upgraded to WebSocket (ws/wss).
await client.connect(timeout?: number): Promise<void>
await client.disconnect(): Promise<void>
await client.ping(token?: string): Promise<void>// Load and start a pipeline
const result = await client.use(options: {
filepath?: string, // Path to pipeline JSON
pipeline?: object, // Inline pipeline definition
env?: Record<string, string>, // Environment variables for substitution
}): Promise<PIPELINE_RESULT>
// Check pipeline status
const status = await client.getTaskStatus(token: string): Promise<TASK_STATUS>
// Stop a running pipeline
await client.terminate(token: string): Promise<void>// Send text data to a pipeline
await client.send(
token: string,
data: string | object,
options?: { mimeType?: string, provider?: string }
): Promise<PIPELINE_RESULT>
// Send files to a pipeline
await client.sendFiles(
token: string,
files: string[], // File paths
options?: { provider?: string }
): Promise<UPLOAD_RESULT>
// Stream data via a pipe (for large datasets)
const pipe = await client.pipe(
token: string,
objinfo?: Record<string, unknown>,
mimeType?: string,
provider?: string
): Promise<DataPipe>
await pipe.open();
await pipe.write(new Uint8Array([...]));
const result = await pipe.close();const answer = await client.chat(options: {
token: string,
question: Question,
}): Promise<Answer>Building a question:
import { Question } from 'rocketride';
const q = new Question();
q.addQuestion('What are the key findings?');
// Or with more detail
const q2 = new Question();
q2.addQuestion('Explain the results');
q2.addHistory({ role: 'user', content: 'Previous question' });
q2.addHistory({ role: 'assistant', content: 'Previous answer' });// Subscribe to specific event types
await client.setEvents(token: string, eventTypes: string[]): Promise<void>Event callbacks are set in the constructor config:
const client = new RocketRideClient({
auth: 'key',
uri: 'http://localhost:5565',
onEvent: (event) => {
console.log('Event type:', event.type);
console.log('Event body:', event.body);
},
onConnected: () => console.log('Connected'),
onDisconnected: (reason) => console.log('Disconnected:', reason),
onConnectError: (error) => console.log('Error:', error),
});// List available services on the server
const services = await client.getServices(): Promise<Record<string, unknown>>| Variable | Purpose |
|---|---|
ROCKETRIDE_URI |
Default server URI |
ROCKETRIDE_APIKEY |
Default API key |
These are loaded from the process environment or a .env file in the current directory. Values passed in the constructor override environment variables.
The SDK ships as both CommonJS and ESM:
// ESM
import { RocketRideClient } from 'rocketride';
// CommonJS
const { RocketRideClient } = require('rocketride');The package includes a rocketride CLI tool:
npx rocketride --help- Client SDK (Python) -- Python SDK reference
- Pipeline API -- pipeline JSON structure
- Quickstart -- quick start guide
Getting Started
Architecture
API Reference
Contributing
Governance