Skip to main content
New protocol version released: This page may contain outdated information.
The HAIP Server is a complete, production-ready reference implementation of the HAI Protocol. It provides a fully functional server that supports all HAIP transport types, authentication, tool integration, and monitoring capabilities.

Production Ready

Docker support, monitoring, security, and comprehensive testing

Multiple Transports

WebSocket, Server-Sent Events (SSE), and HTTP streaming support

Tool Integration

Dynamic tool registration and execution with built-in test tools

100% Test Coverage

93/93 tests passing with no async cleanup issues

Features

Core Protocol Support

  • Complete HAIP Implementation - All message types and event handling
  • Multi-Transport Support - WebSocket, SSE, and HTTP streaming
  • Authentication - JWT token validation and session management
  • Flow Control - Credit-based flow control with adaptive adjustment
  • Error Handling - Comprehensive error codes and recovery

Production Features

  • Docker Support - Containerized deployment with docker-compose
  • Health Monitoring - Real-time statistics and health checks
  • Security - Helmet.js, CORS, compression, and rate limiting
  • Logging - Structured logging with Morgan
  • Session Management - Per-client session tracking with cleanup

Tool Integration

  • Dynamic Tool Registration - Register tools at runtime
  • Built-in Test Tools - Echo, add, and weather tools included
  • Tool Lifecycle - Call, update, complete, and cancel operations
  • Schema Validation - JSON Schema validation for tool inputs/outputs

Development Features

  • TypeScript - Full type safety and IntelliSense support
  • Event System - Comprehensive event emission for all operations
  • Test Suite - 100% test coverage with Jest
  • Examples - Working examples for all major features

Architecture

The HAIP Server is built with a modular, event-driven architecture:

Key Components

Server Core

  • HAIPServer - Main server class extending EventEmitter
  • Session Management - Per-client session tracking with flow control
  • Message Routing - Route messages to appropriate handlers
  • Event System - Emit events for all server operations

Transport Layer

  • WebSocket Server - Full-duplex communication
  • SSE Endpoint - Server-sent events for one-way streaming
  • HTTP Streaming - HTTP-based bidirectional streaming

Tool System

  • Tool Registry - Dynamic tool registration and management
  • Tool Executor - Execute tools with progress updates
  • Schema Validation - Validate tool inputs and outputs

Monitoring

  • Statistics - Real-time server statistics
  • Health Checks - /health and /stats endpoints
  • Logging - Structured logging with different levels

Quick Start

Get started with the HAIP Server in minutes:
The server will be available at:
  • WebSocket: ws://localhost:8080/haip/websocket
  • SSE: http://localhost:8080/haip/sse
  • HTTP Streaming: http://localhost:8080/haip/stream
  • Health Check: http://localhost:8080/health
  • Statistics: http://localhost:8080/stats

Docker Deployment

Deploy with Docker for production:

Configuration

The server is highly configurable through environment variables or configuration objects:

Built-in Tools

The server includes several built-in tools for testing and development:

Echo Tool

Add Tool

Weather Tool

Testing

The server includes comprehensive tests:
Test Results: 93/93 tests passing (100% coverage)

Next Steps

Repository

Contributing

The HAIP Server is open source and welcomes contributions:
  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new features
  5. Submit a pull request

License

MIT License - see LICENSE for details.