Overview
HAIP is transport-agnostic, supporting multiple communication protocols. Choose the transport that best fits your use case and infrastructure requirements.WebSocket (Recommended)
WebSockets provide bidirectional, real-time communication with low latency and full-duplex capabilities.Advantages
- Bidirectional: Both client and server can send messages at any time
- Low Latency: Minimal overhead for real-time applications
- Full-Duplex: Simultaneous sending and receiving
- Wide Support: Available in all modern browsers and platforms
Server-Sent Events (SSE)
SSE provides one-way streaming from server to client, ideal for scenarios where the client primarily receives data.Advantages
- Simple: Easy to implement and debug
- Automatic Reconnection: Built-in reconnection handling
- HTTP Compatible: Works through proxies and firewalls
- Event-Driven: Native event handling
HTTP Streaming
HTTP streaming provides a simple way to stream data over standard HTTP connections.Advantages
- Universal: Works with any HTTP client
- Proxy Friendly: Passes through corporate firewalls
- Simple: No special client libraries required
- Compatible: Works with existing HTTP infrastructure
Message Bus Integration
HAIP can be integrated with message buses like Redis, RabbitMQ, or Apache Kafka.Redis Pub/Sub Example
Transport Selection Guide
WebSocket
Best for: Real-time chat, gaming, collaborative applications Pros:
Bidirectional, low latency, full-duplex Cons: More complex, requires
WebSocket support
Server-Sent Events
Best for: Notifications, live updates, one-way streaming Pros: Simple,
automatic reconnection, HTTP compatible Cons: One-way only, limited
browser support
HTTP Streaming
Best for: Simple integrations, proxy environments Pros: Universal,
proxy friendly, simple Cons: Higher latency, no binary support
Message Bus
Best for: Microservices, distributed systems Pros: Scalable,
decoupled, reliable Cons: Complex setup, additional infrastructure