🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

engine.io

Package Overview
Dependencies
Maintainers
1
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

engine.io

The realtime engine behind Socket.IO. Provides the foundation of a bidirectional connection between client and server

0.3.9
Source
npm
Version published
Weekly downloads
9.6M
6%
Maintainers
1
Weekly downloads
 
Created

What is engine.io?

The engine.io npm package is a core component for building real-time web applications. It is designed to be efficient and includes a robust WebSocket and polling implementation. Engine.io provides a low-level API that handles the WebSocket connections, including fallbacks to alternative protocols if WebSockets are not supported by the client or server environments. This makes it an excellent choice for developing applications that require real-time bidirectional event-based communication.

What are engine.io's main functionalities?

Server Initialization

This feature allows you to initialize an engine.io server. You can listen for connections and handle messages and disconnections from clients.

const { Server } = require('engine.io');
const server = new Server({ /* options */ });
server.on('connection', (socket) => {
  console.log('a user connected');
  socket.on('message', (data) => {
    console.log(data);
  });
  socket.on('close', () => {
    console.log('user disconnected');
  });
});

Client Initialization

This feature demonstrates how to initialize a connection to an engine.io server from the client side. It includes handling open, message, and close events.

const { Socket } = require('engine.io-client');
const socket = new Socket('ws://localhost');
socket.on('open', () => {
  console.log('connection established');
  socket.send('Hello server!');
});
socket.on('message', (data) => {
  console.log(data);
});
socket.on('close', () => {
  console.log('connection closed');
});

Other packages similar to engine.io

FAQs

Package last updated on 23 Oct 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts