Home

Kristen Data Comms (KDC-JS)

JavaScript API Documentation — Version 0.9.0

Copyright © 2026 Kristen Software, LLC. All rights reserved.

Overview

Kristen Data Comms (KDC) is a distributed systems framework that enables applications to exchange software Agents across networks.

KDC Agents encapsulate task logic and data. KDC transmits their serialized state and reconstructs them using compatible Agent classes already available at the destination. Agents can then interact with local APIs to perform application-specific operations.

KDC-JS provides JavaScript client functionality for communicating with KDC servers.

Key Features

  • WebSocket communication with KDC servers.
  • Automatic or explicit connection management.
  • Asynchronous Agent transmission.
  • Synchronous Agent/Reply communication.
  • Registered Agent classes for deserialization.
  • Event handlers for incoming Agents, Replies, and connection events.
  • Configurable serialization and communication parameters.

Getting Started

The following example demonstrates a JavaScript client connecting to a KDC WebSocket server and sending an Agent synchronously.

Hello World — WebSocket Client

import {
    WebSocketClient,
    WebSocketClientParametersBuilder
} from "kdc-js";

// Import your application-specific Agent class.
import { SayHelloWithReply } from "./SayHelloWithReply.js";

// Configure the WebSocket client.
const parameters = new WebSocketClientParametersBuilder()
        .withServerUrl("ws://localhost:8080/kdc")
        .registerAgent(
                SayHelloWithReply,
                "com.kristensoft.kristendemo.agents.SayHelloWithReply"
        )
        .build();

// Create the client. Automatic connection is enabled by default.
const client = new WebSocketClient(parameters);

try {

    // Construct an Agent.
    const agent = new SayHelloWithReply("Test");

    agent.setVisitorMethod(
            "visit",
            "com.kristensoft.kristendemo.api.HelloWorldAPI"
    );

    agent.setData("message", "Hello World, Client! KDC Rocks!!");

    // Send the Agent and wait for its Reply.
    const reply = await client.sendSync(agent);

    console.log("Success:", reply.success);
    console.log("Reply:", reply.getData("message"));

} finally {

    await client.close();
}

The example assumes a compatible KDC server is running and that the application's Agent class is available to both endpoints.

The client automatically initiates its connection during construction. sendSync() waits for an in-progress connection before sending.

To manage the connection manually, configure .withAutoStart(false) and call await client.connect() before sending.

API Reference

Use the navigation menu to explore the available classes and methods.

For more information about Kristen Data Comms, visit Kristen Software.