# socketio/socket.io-client

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/socketio-socket-io-client).**

10,601 stars · 2,978 forks

## Links

- GitHub: https://github.com/socketio/socket.io-client
- Homepage: https://socket.io
- awesome-repositories: https://awesome-repositories.com/repository/socketio-socket-io-client.md

## Topics

`browser` `javascript` `nodejs` `socket-io` `websocket`

## Description

Socket.IO Client is a real-time WebSocket client library that establishes persistent bidirectional connections to a server, with automatic fallback to HTTP long-polling when WebSocket connections are unavailable. It provides an event-based bidirectional messaging framework where clients and servers exchange named events with serializable data, supporting acknowledgements and timeouts for reliable communication.

The client distinguishes itself through automatic reconnection with exponential backoff, maintaining connection reliability by monitoring health and reconnecting with increasing delays to handle transient network failures gracefully. It supports namespace-isolated communication channels, allowing a single connection to be partitioned into logical namespaces for separating application logic and authorization boundaries. The library also includes a buffer-and-replay packet queue that queues outgoing packets during disconnection and replays them in order upon successful reconnection, along with volatile event dropping for non-critical messages that can be silently discarded when the socket is disconnected or the transport is congested.

Additional capabilities include cross-origin connection support for connecting to servers from different domains, event acknowledgment with optional timeout handling, and the ability to broadcast events to all connected clients or room subsets across multiple server instances. The client also provides debug logging with scoped output for troubleshooting, and supports stripping debug instrumentation from production bundles to reduce payload size.

## Tags

### Networking & Communication

- [Real-Time Connections](https://awesome-repositories.com/f/networking-communication/server-connection-managers/real-time-connections.md) — Establishes real-time bidirectional connections to servers using WebSocket or HTTP long-polling with automatic reconnection. ([source](https://socket.io/docs/v4/client-api/))
- [Custom Event Emissions](https://awesome-repositories.com/f/networking-communication/client-event-listeners/custom-event-emissions.md) — Sends custom events to the server and handles incoming events using a publish-subscribe pattern. ([source](https://cdn.jsdelivr.net/gh/socketio/socket.io-client@main/README.md))
- [Namespace-Based Communication](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/communication-architectures/namespace-based-communication.md) — Partitions a single connection into logical namespaces to separate application logic and authorization boundaries.
- [Client-to-Server Event Emission](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/communication-paradigms/client-to-server-event-emission.md) — Enables emitting named events with serializable data from client to server, with optional acknowledgement. ([source](https://socket.io/docs/v4/client-api/))
- [Namespace Connectivity](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/communication-paradigms/namespace-connectivity.md) — Allows specifying a namespace path in the connection URL to isolate communication channels within the same server. ([source](https://socket.io/docs/v4/client-initialization/))
- [Server-to-Client Event Emissions](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/communication-paradigms/server-to-client-event-emissions.md) — Ships a server-to-client event emission system for broadcasting messages to all connected clients or room subsets. ([source](https://socket.io/docs/v4/))
- [Automatic Reconnection Logic](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/communication-paradigms/server-to-client-event-emissions/connection-reconnection-policies/automatic-reconnection-logic.md) — Implements automatic reconnection with exponential backoff to restore dropped connections without manual intervention.
- [WebSocket and Fallback Connection Establishment](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/communication-protocols-standards/network-protocols/connection-establishment-protocols/websocket-and-fallback-connection-establishment.md) — Establishes WebSocket connections and transparently falls back to HTTP long-polling when WebSockets are unavailable. ([source](https://cdn.jsdelivr.net/gh/socketio/socket.io-client@main/README.md))
- [Namespace Multiplexing](https://awesome-repositories.com/f/networking-communication/messaging-channel-management/asynchronous-event-multiplexers/namespace-multiplexing.md) — Provides namespace multiplexing to isolate communication channels on a single socket connection. ([source](https://socket.io/docs/v4/))
- [WebSocket and HTTP Fallback Transports](https://awesome-repositories.com/f/networking-communication/protocol-agnostic-transport-layers/websocket-and-http-fallback-transports.md) — Automatically selects the best available transport and falls back to HTTP long-polling when WebSocket connections fail.
- [Client-Side Event Listeners](https://awesome-repositories.com/f/networking-communication/real-time-event-streams/server-event-handlers/client-side-event-listeners.md) — Implements client-side event listeners that execute callbacks when named server events arrive. ([source](https://socket.io/docs/v4/client-api/))
- [WebSocket Clients](https://awesome-repositories.com/f/networking-communication/websocket-clients.md) — Establishes persistent bidirectional WebSocket connections with automatic HTTP long-polling fallback.
- [Cross-Origin Client Connections](https://awesome-repositories.com/f/networking-communication/client-connectivity-management/cross-origin-client-connections.md) — Supports connecting to servers from different domains with proper CORS configuration.
- [Event Acknowledgement Strategies](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/communication-paradigms/event-delivery-controls/event-acknowledgement-strategies.md) — Sends events and waits for a response from the receiver, with an optional timeout for unacknowledged messages. ([source](https://socket.io/docs/v4/))
- [Acknowledgment Timeouts](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/communication-paradigms/event-delivery-controls/event-acknowledgement-strategies/acknowledgment-timeouts.md) — Provides event acknowledgment with optional timeout handling for unacknowledged messages.
- [Volatile Event Emission](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/communication-paradigms/event-delivery-controls/volatile-event-emission.md) — Marks events as volatile so they are silently discarded when the socket is disconnected or the transport is congested.
- [Disconnection Buffers](https://awesome-repositories.com/f/networking-communication/packet-buffering/disconnection-buffers.md) — Queues outgoing packets during disconnection and replays them in order upon successful reconnection.
- [External Process Emissions](https://awesome-repositories.com/f/networking-communication/real-time-messaging/external-process-emissions.md) — Allows external Node.js processes to broadcast packets to all connected clients via the adapter's emitter package. ([source](https://socket.io/docs/v4/adapter/))
- [Long-Polling Event Pushing](https://awesome-repositories.com/f/networking-communication/remote-procedure-calls/long-polling-event-pushing.md) — Automatically downgrades to HTTP long-polling when WebSocket or WebTransport connections cannot be established. ([source](https://socket.io/docs/v4/))

### Web Development

- [Real-Time Communication](https://awesome-repositories.com/f/web-development/real-time-communication.md) — Establishes low-latency bidirectional connections with automatic transport fallback and reconnection for real-time communication. ([source](https://cdn.jsdelivr.net/gh/socketio/socket.io-client@main/README.md))

### Artificial Intelligence & ML

- [Cross-Origin Server Connections](https://awesome-repositories.com/f/artificial-intelligence-ml/external-server-connectivity/server-connection-managers/custom-server-connections/cross-origin-server-connections.md) — Accept a server URL to establish a real-time connection across origins, requiring CORS to be enabled on the server. ([source](https://socket.io/docs/v4/client-initialization/))

### Part of an Awesome List

- [Named Event Messaging Frameworks](https://awesome-repositories.com/f/awesome-lists/media/messaging-and-events/named-event-messaging-frameworks.md) — Provides a framework for sending and receiving named events with acknowledgements over real-time connections.
- [Named Event Transmissions](https://awesome-repositories.com/f/awesome-lists/media/messaging-and-events/named-event-transmissions.md) — Implements named event transmission with arbitrary data payloads between client and server in real time. ([source](http://slack.socket.io/))

### Programming Languages & Runtimes

- [Real-Time Namespace Channels](https://awesome-repositories.com/f/programming-languages-runtimes/code-definition-namespaces/namespace-sharing/real-time-namespace-channels.md) — Splits application logic over a single connection using namespaces to create isolated communication channels. ([source](https://socket.io/docs/v4/))
- [Scoped Console Debug Logging](https://awesome-repositories.com/f/programming-languages-runtimes/standard-input-output-streams/output-stream-adaptation/test-output-streams/console-output-debugging/scoped-console-debug-logging.md) — Prints scoped debug messages to the browser console when enabled via a storage flag for troubleshooting. ([source](https://cdn.jsdelivr.net/gh/socketio/socket.io-client@main/README.md))

### Security & Cryptography

- [Namespace-Based Isolation](https://awesome-repositories.com/f/security-cryptography/multi-tenant-isolation/namespace-based-isolation.md) — Splits application logic over a single connection by creating separate channels, such as an admin area for authorized users. ([source](https://socket.io/docs/v4/))

### Software Engineering & Architecture

- [Event-Driven Frameworks](https://awesome-repositories.com/f/software-engineering-architecture/event-driven-frameworks.md) — Provides an event-driven framework for sending and receiving named events with acknowledgements over real-time connections.
- [Named Event Exchanges](https://awesome-repositories.com/f/software-engineering-architecture/message-based-event-handlers/named-event-exchanges.md) — Provides event-based bidirectional messaging with named events, acknowledgements, and timeouts over a persistent connection.
- [Message Broadcasting Adapters](https://awesome-repositories.com/f/software-engineering-architecture/distributed-systems/cluster-synchronization-adapters/message-broadcasting-adapters.md) — Provides a pluggable adapter interface for external processes to broadcast events to all connected clients.

### Data & Databases

- [Cross-Instance Event Broadcasting](https://awesome-repositories.com/f/data-databases/record-updating/live-update-subscriptions/event-stream-broadcasters/cross-instance-event-broadcasting.md) — Routes real-time events to all connected clients across multiple server instances for horizontal scaling. ([source](https://socket.io/docs/v4/adapter/))
- [Multi-Instance Event Broadcasting](https://awesome-repositories.com/f/data-databases/record-updating/live-update-subscriptions/event-stream-broadcasters/custom-event-broadcasting/multi-instance-event-broadcasting.md) — Routes real-time events to all connected clients or room subsets across multiple server instances.

### Operating Systems & Systems Programming

- [PID Namespace Isolation](https://awesome-repositories.com/f/operating-systems-systems-programming/kernel-core-internals/process-and-memory-management/process-isolation/namespace-based-isolation/pid-namespace-isolation.md) — Partitions a single connection into isolated logical namespaces for separating application logic and authorization boundaries.

### System Administration & Monitoring

- [Scoped Client-Side Debug Logging](https://awesome-repositories.com/f/system-administration-monitoring/audit-log-filters/log-event-filters/scoped-client-side-debug-logging.md) — Prints debug messages to the browser console filtered by scope to aid development and troubleshooting. ([source](https://cdn.jsdelivr.net/gh/socketio/socket.io-client@main/README.md))
- [Debug Log Filters](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/cross-account-observability-aggregators/observability-data-filters/debug-log-filters.md) — Filters debug output to specific modules using wildcards and scope names separated by commas. ([source](https://socket.io/docs/v4/logging-and-debugging/))
- [Debug Logging Management](https://awesome-repositories.com/f/system-administration-monitoring/monitoring-and-observability/observability-platforms/log-management-systems/debug-logging-management.md) — Activates scoped debug output via environment variable or storage flag to inspect internal module activity. ([source](https://cdn.jsdelivr.net/gh/socketio/socket.io-client@main/README.md))
