#!/usr/bin/env node // Scenario 1: Command & Control (Small JSON) // Tests small JSON payloads (< 1MB) sent directly via NATS const { SmartSend } = require('../js_bridge'); // Configuration const CONTROL_SUBJECT = "control"; const NATS_URL = "nats://localhost:4222"; // Create correlation ID for tracing const correlationId = require('uuid').v4(); // Sender: Send control command to Julia async function sendControlCommand() { const config = { step_size: 0.01, iterations: 1000 }; // Send via SmartSend with type="json" const env = await SmartSend( CONTROL_SUBJECT, config, "json", { correlationId } ); console.log(`Sent control command with correlation_id: ${correlationId}`); console.log(`Envelope: ${JSON.stringify(env, null, 2)}`); } // Run the sender sendControlCommand().catch(console.error);