Skip to main content
Unsupported HAIP 1 archive. This is historical chat and streaming documentation, not the HAIP 2 review protocol. Its APIs, package examples and security advice must not be used for a HAIP 2 deployment. Start with the current HAIP 2 guides.

Overview

WebSocket is the recommended transport for HAIP due to its bidirectional, real-time capabilities. This guide covers implementing HAIP over WebSocket connections with proper error handling and reconnection logic.

Basic WebSocket Setup

Client-Side Implementation

Server-Side Implementation

Binary Frame Support

Sending Binary Data

Receiving Binary Data

Connection Management

Health Monitoring

Reconnection Logic

Best Practices

Connection State

Always check WebSocket readyState before sending messages.

Error Handling

Comprehensive error handling with automatic recovery and user feedback.

Reconnection

Automatic reconnection with exponential backoff and connection state management.

Health Monitoring

Monitor connection health with ping/pong and automatic health checks.