# sockjs/sockjs-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/sockjs-sockjs-client).**

8,518 stars · 1,273 forks · JavaScript · MIT

## Links

- GitHub: https://github.com/sockjs/sockjs-client
- awesome-repositories: https://awesome-repositories.com/repository/sockjs-sockjs-client.md

## Topics

`javascript` `real-time` `sockjs` `websocket`

## Description

sockjs-client is a JavaScript library that provides a WebSocket-compatible API for real-time, bidirectional communication between a web browser and a server. It functions as a transport-layer abstraction that ensures a stable full-duplex connection by emulating socket behavior.

The library is distinguished by its automatic protocol-fallback mechanisms. When native WebSockets are unavailable or blocked by restrictive network environments, such as firewalls or proxies, it switches to HTTP-streaming emulation or XHR-polling to maintain connectivity.

It covers capabilities for cross-domain data streaming and session-based connection tracking. The client interface allows for the configuration of transport options, timeout durations, and custom session identifiers to manage communication channels across different domains.

## Tags

### Networking & Communication

- [Real-Time Web Communication](https://awesome-repositories.com/f/networking-communication/real-time-web-communication.md) — Establishes low-latency, bidirectional connections between web browsers and servers for live data exchange.
- [Communication Channels](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/communication-channels.md) — Provides a standardized interface for establishing low-latency, bidirectional communication channels between web browsers and servers. ([source](https://github.com/sockjs/sockjs-client/blob/main/README.md))
- [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 bidirectional connections with automatic HTTP long-polling fallback when native WebSockets are unavailable.
- [Fallback Mechanisms](https://awesome-repositories.com/f/networking-communication/communication-protocols-architectures/communication-protocols-standards/transport-protocols/fallback-mechanisms.md) — Automatically switches from native sockets to streaming or polling based on environment constraints and server capabilities.
- [Transport Abstraction Layers](https://awesome-repositories.com/f/networking-communication/networking/transport-abstraction-layers.md) — Provides a unified protocol layer that wraps different communication mechanisms in a consistent API for bidirectional exchange.
- [WebSocket and HTTP Fallback Transports](https://awesome-repositories.com/f/networking-communication/protocol-agnostic-transport-layers/websocket-and-http-fallback-transports.md) — Transparently switches between WebSockets and HTTP long-polling to maintain connectivity in restrictive network environments. ([source](https://github.com/sockjs/sockjs-client#readme))
- [Multi-Transport Real-time Layers](https://awesome-repositories.com/f/networking-communication/real-time-event-streams/multi-transport-real-time-layers.md) — Provides an abstraction layer that maintains stable full-duplex connections by switching between WebSockets and legacy HTTP transports.
- [Restrictive Network Connectivity](https://awesome-repositories.com/f/networking-communication/restrictive-network-connectivity.md) — Ensures application communication works in environments where firewalls or proxies block standard WebSocket traffic.
- [HTTP Bidirectional Streaming](https://awesome-repositories.com/f/networking-communication/bidirectional-streaming-protocols/http-bidirectional-streaming.md) — Implements bidirectional message streaming over HTTP to emulate a continuous data stream for real-time updates.
- [Cross-Origin Client Connections](https://awesome-repositories.com/f/networking-communication/client-connectivity-management/cross-origin-client-connections.md) — Provides a client-side interface for establishing cross-origin connections to servers on different domains.
- [Cross-Domain Data Streaming](https://awesome-repositories.com/f/networking-communication/cross-domain-data-streaming.md) — Enables the sending and receiving of real-time data between a web browser and a server hosted on a different domain.
- [Connection and Session Management](https://awesome-repositories.com/f/networking-communication/network-reliability-diagnostics/connection-session-management.md) — Tracks and maintains the lifecycle of active network connections using unique session identifiers across stateless requests.
- [Cross-Domain Socket Support](https://awesome-repositories.com/f/networking-communication/unix-domain-socket-support/cross-domain-socket-support.md) — Enables real-time communication between a browser and a server hosted on a different domain across various transport protocols. ([source](https://github.com/sockjs/sockjs-client/blob/main/README.md))
- [XHR Polling Fallbacks](https://awesome-repositories.com/f/networking-communication/xhr-polling-fallbacks.md) — Implements a recurring request cycle to fetch updates as a fallback when advanced streaming or socket options are unavailable.

### Web Development

- [Browser-Based Socket Interfaces](https://awesome-repositories.com/f/web-development/browser-based-socket-interfaces.md) — Provides a standardized browser interface for managing session identifiers and transport timeouts for real-time data exchange.
- [WebSocket Emulation Libraries](https://awesome-repositories.com/f/web-development/websocket-emulation-libraries.md) — Offers a WebSocket-compatible API with automatic fallbacks to streaming or polling to ensure broad browser support.
- [Cross-Domain Request Handling](https://awesome-repositories.com/f/web-development/cross-domain-request-handling.md) — Utilizes specific browser communication patterns to enable real-time data exchange between clients and servers on different domains.
