3.1.1 · normalize once · cross every boundary

One message shape. Everywhere.

Create a predictable { type, data } convention, omit fields a signal does not need, and load it through ESM, CommonJS, browsers, WebSockets, IPC, workers, or any JavaScript host.

js-message works with bundlers and without a bundler. Bundlers resolve the bare js-message import normally; native browser ESM resolves it through a standard import map, with no build or transpilation step.

  • 0 runtime dependencies
  • Version 3.1.1
  • ESM + CommonJS
  • Browser global included
  • No build step
import Message from 'js-message';

const message = new Message();

message.type = 'user.updated';
message.data = {
    id: 42,
    active: true
};

socket.send(message.JSON);
A structured message crossing a glowing normalization gate between browser and server endpoints

Choose the page you need

Short routes, not one endless manual.

Each topic has a focused page, so implementation details stay close and navigation stays fast.

Build

Start in minutes

Install, create, serialize, and receive a message.

Get started →
Integrate

Know the API

See every field, method, return value, and failure mode.

Open the API →
Choose

Know why it fits

Compare the tiny convention with schema validators and transport clients.

Why js-message →
Design

Know the protocol

Understand optional fields, ignored extras, and error recovery.

Read the contract →
Experiment

Run the real module

Edit visible JavaScript and inspect each message at the boundary.

Open the playground →
Measure

See one million messages move

Inspect reproducible 3.0-to-3.1 benchmarks, charts, and raw results.

See performance →
Verify

Audit the evidence

Review vanilla-test coverage, compatibility, and package checks.

Inspect testing →

Install

One tiny package. Nothing at runtime.

The public module uses only JavaScript and native JSON behavior. Version 3.1.1 supports ESM and CommonJS on Node 22.13+ with zero runtime dependencies.

npm install js-message