ngx-socket
Language

Angular Realtime Library

ngx-socket

SSR-safe Socket.IO setup for Angular apps that want one place for realtime connection configuration and event flow.

One focused package for browser-only socket startup, shared connection config, and reusable realtime helpers.

landing.ts

Project Overview

Package

ngx-socket

Socket.IO client wiring for Angular, extracted from ngx-core and kept SSR-safe by default.

License

MIT

Published as a public package and designed for reuse across multiple apps.

Installation

Install the package

$ npm i --save ngx-socket

Usage

Bootstrap with provideNgxSocket()

import { provideNgxSocket } from 'ngx-socket';

export const appConfig = {
  providers: [provideNgxSocket()],
};

Configuration

Centralize realtime connection setup

Configure the socket endpoint and client factory once instead of scattering connection setup across components.

import { provideNgxSocket } from 'ngx-socket';
import { io } from 'socket.io-client';

export const appConfig = {
  providers: [
    provideNgxSocket({
      socket: {
        url: 'https://realtime.example.com',
        opts: { transports: ['websocket'] },
      },
      io: io,
    }),
  ],
};

Features

What ngx-socket includes

Bootstrap and configuration

Standalone-first setup centered on provideNgxSocket() for realtime defaults.

provideNgxSocket() | socket / io config | SSR-safe browser-only client startup

Realtime service

Focused runtime behavior for Socket.IO event binding, connection state, and emits.

SocketService | Config, SocketConfig, CONFIG_TOKEN | Emitter-backed lifecycle notifications

Reference

Documented feature pages

The detailed page below covers the Socket feature and its public API surface.