Skip to content

Example Setup

This example is split into two parts, the ./host.js and the ./client.js. However it is possible to use Echo-D in other network topologies. It is important to prevent the flow of data from the various nodes to not cycle around or else it will create an infinite loop. To prevent this, it is recommended to use the mask option in the updater method as well as the other options in the EchoD constructor.


Events

Uses EventEmitter from node:events to create an events object. This can be bundled for use in browsers with a bundler such as esbuild, webpack, bun build, or another bundler.

events.js
import { EventEmitter } from 'node:events';
export const events = new EventEmitter( );