Frameworks

Socket.IO Cheat Sheet

Print-ready cheat sheet for Socket.IO, organized for fast lookup, study, and desk-side use

Source
Socket.IO Documentation (socket.io/docs)
License
MIT
Updated
2026-03-27

Sample

What's in this cheat sheet

  • Setup
  • Events
  • Emitting
  • Broadcasting
  • Rooms
  • Namespaces
  • Middleware
  • Error Handling
  • Acknowledgements
  • Common Patterns

Server Setup (Node.js)

import { Server } from "socket.io";
const io = new Server(3000, {
  cors: { origin: "http://localhost:5173" }
});

Client Setup

import { io } from "socket.io-client";
const socket = io("http://localhost:3000");

With Express

import express from "express";
import { createServer } from "http";
import { Server } from "socket.io";
const app = express();
const server = createServer(app);
const io = new Server(server);

Download the full cheat sheet for all sections, formatted for print

Download PDF

Downloads

Choose the treatment that matches how you read