Home Getting Started Server Client Shared Types GitHub ↗
Real-time · Open Source · v1.2.x

The Communication Layer
Your App Deserves

Type-safe, real-time WebSocket messaging with authentication, presence, group chat, voice and conference calling, and 12 React hooks — built on Socket.IO.

3Packages
12React Hooks
63Socket Events
0Config Required

What's included

Everything you need to build real-time apps

Three focused packages. Compose only what you need — from simple one-to-one chat to full group messaging with offline queuing.

Type-Safe Events

Shared SocketEvent enum and EventPayloads interface ensure server and client are always in sync. No more stringly-typed events or mismatched payloads.

🔌

Plugin Architecture

Compose only what you need. .useAuth(), .usePresence(), .useMessaging(), .useGroupMessaging() — each plugin is fully independent.

💬

Group Messaging

Full group chat: create, join, leave, typing indicators, message history, and queued offline messages delivered automatically on reconnect.

⚛︎

12 React Hooks

Purpose-built hooks: useSocket, useMessages, useSendMessage, usePresence, useTypingIndicator, useGroup, useGroupMessages, useGroupTyping, useUserGroups, useSocketEvent, useVoiceCall, useConferenceCall.

📞

P2P Voice & Video Calling

WebRTC peer-to-peer calls with ICE/STUN/TURN signaling. Sockr handles SDP offer/answer relay and trickle ICE — the useVoiceCall hook manages the full call lifecycle and media streams.

🎙️

SFU Group Conferences

Multi-party group calling via a Selective Forwarding Unit (LiveKit or custom). The server manages room creation and token generation — clients connect directly to the SFU using useConferenceCall.

📱

Multi-Device Support

Users can connect from multiple sockets simultaneously. Offline events broadcast only when the user's last socket disconnects — works seamlessly across tabs and devices.

🗄️

Pluggable Storage

Bring your own database: MongoDB, PostgreSQL, MySQL, or in-memory. Plus Redis or in-memory queue and cache providers. Implement IMessageStore for any backend.

Architecture

Three packages, one protocol

Shared TypeScript types keep server and client in perfect sync — no code generation needed.

sockr-client v1.2.0 React · Vanilla · React Native sockr-server v1.2.0 Socket.IO · Express Auth · Presence · Messaging · Groups sockr-shared v1.3.0 TypeScript · Zero deps WebSocket Socket.IO shared types client also imports shared types directly

Installation

Up in seconds

Install from npm. Zero peer dependency conflicts.

npm install sockr-server sockr-client sockr-shared
pnpm add sockr-server sockr-client sockr-shared
yarn add sockr-server sockr-client sockr-shared

Quick Start

Start building in minutes

A minimal server and React client — ready to run.

server.ts sockr-server
import { SocketServer } from 'sockr-server';

const server = new SocketServer({ port: 3000 });

server
  .createStandalone()
  .useAuth(async (token) => {
    const user = await verifyToken(token);
    return user ? { userId: user.id } : null;
  })
  .usePresence()
  .useMessaging()
  .useGroupMessaging();

await server.listen();
App.tsx sockr-client
import { SocketProvider } from 'sockr-client/react';
import {
  useMessages,
  useSendMessage,
  usePresence,
} from 'sockr-client/react';

function App() {
  return (
    <SocketProvider
      config={{ url: "http://localhost:3000" }}
      token={authToken}
    >
      <Chat />
    </SocketProvider>
  );
}

function Chat() {
  const { messages } = useMessages();
  const { sendMessage } = useSendMessage();
  const { isUserOnline } = usePresence();
  // ...
}
Read the full guide →

Packages

Explore the docs

sockr-server@1.2.0

Server SDK →

Plugin-based WebSocket server. Supports standalone, HTTP attach, and Express modes. Auth, Presence, Messaging, Group, Voice, and Conference plugins with full adapter support.

sockr-client@1.2.0

Client SDK →

Framework-agnostic SocketClient core plus 12 React hooks including useVoiceCall and useConferenceCall. Works with React, React Native, and plain JavaScript.

sockr-shared@1.3.0

Shared Types →

Zero-dependency type definitions. The SocketEvent enum, EventPayloads, and all core interfaces — the single source of truth for the protocol.