Skip to main content
Here’s how to use the /invoke/stdout endpoint with Node.js to stream Server-Sent Events (SSE) from the Cloud Coding API. We’ll use the eventsource package, which simplifies handling SSE connections.

Installation

First, add the eventsource package to your project:
The following examples use require for Node.js compatibility. If you are using ES modules, you can use import EventSource from 'eventsource'.

Single Task Invocation

This example invokes a single task and listens for updates and custom events from the stream.

Parallel Task Invocation

This example runs two tasks in parallel. The custom event’s data includes a task_name, which you can use to identify which task produced the output.