WebSocket
Real-time, full-duplex communication over a single TCP connection.
What is WebSocket?
WebSocket is a protocol that provides full-duplex communication channels over a single TCP connection. Unlike HTTP (request-response) or SSE (server-to-client only), WebSocket allows both the client and server to send messages to each other at any time, making it ideal for real-time applications.
Key Characteristics:
- •Full-duplex: Both parties can send messages simultaneously
- •Low latency: No HTTP overhead after initial handshake
- •Persistent connection: Single connection stays open for entire session
- •Binary support: Can send text or binary data natively
WebSocket vs HTTP vs SSE
| Feature | HTTP | SSE | WebSocket |
|---|---|---|---|
| Direction | Request-Response | Server → Client | Bidirectional |
| Connection | New per request | Persistent | Persistent |
| Data Format | Any | Text only | Text + Binary |
| Client can send | With new request | No (separate HTTP) | Anytime |
| Use Case | APIs, Web pages | Live feeds, Notifications | Chat, Gaming, Real-time |
Common Use Cases
Chat Applications
Real-time messaging where both users can send messages simultaneously.
Online Gaming
Game state synchronization requiring low latency bidirectional communication.
Collaborative Editing
Multiple users editing the same document in real-time (Google Docs style).
Financial Trading
Live price updates with ability to place orders instantly.
Tigrister WebSocket Features
- 1Multiple message types: Send Text, Binary, Ping, and Pong frames
- 2Binary file support: Upload files as binary messages, download received binary data
- 3Authentication: Bearer Token, Basic Auth, and API Key support in handshake headers
- 4Message filtering: Filter by direction (sent/received) or type (control frames)
- 5Real-time search: Search across all message content instantly
- 6Protocol info: View negotiated subprotocol and extensions