npm.io
6.6.8 • Published 2 weeks ago

engine.io-client

Licence
MIT
Version
6.6.8
Deps
5
Size
821 kB
Vulns
0
Weekly
0
Stars
63.3K

Engine.IO client

Build Status NPM version

Engine.IO is the low-level realtime engine behind Socket.IO.

It provides a reliable, bidirectional communication layer between a Node.js server and a client, using HTTP long-polling first and upgrading to better transports when possible, such as WebSocket or WebTransport.

Table of Contents

Features

  • Reliable realtime communication across browsers, networks, proxies, and load balancers
  • Automatic transport upgrade from HTTP long-polling to WebSocket or WebTransport
  • Binary data support (ArrayBuffer, Blob, etc.)
  • Optional HTTP compression and WebSocket per-message deflate
  • Custom request authorization (e.g., query parameters, headers)
  • Cookie support for sticky sessions
  • Works in Node.js and browser environments
  • TypeScript definitions included

Installation

npm install engine.io-client

Usage

import { Socket } from "engine.io-client";

const socket = new Socket("ws://localhost:8080");

socket.on("open", () => {
  socket.send("hello");
});

socket.on("message", (data) => {
  console.log("received:", data);
});

API

See the API documentation for the full list of available options, methods, events, and properties.

License

MIT