Skip to main content
New protocol version released: This page may contain outdated information.
Master real-time communication with the HAIP SDK’s powerful messaging system. From simple text messages to complex binary data streams, learn how to implement efficient, reliable messaging patterns for your applications.

Message Types

Text Messages

Text messages are the primary communication method in HAIP, supporting streaming and chunked delivery.

Basic Text Message

Streaming Text Messages

For long messages, you can send them in parts:

Binary Messages

Send binary data like audio, images, or files:

Message Channels

HAIP supports multiple channels for different types of communication:

Channel Types

  • USER: User messages and interactions
  • AGENT: Agent responses and actions
  • SYSTEM: Protocol control messages
  • AUDIO_IN: Incoming audio data
  • AUDIO_OUT: Outgoing audio data

Channel Usage

Message Handling

Receiving Messages

Listen for incoming messages:

Message Accumulation

For streaming messages, accumulate parts:

Message Validation

Built-in Validation

The SDK automatically validates messages:

Custom Validation

Add custom validation rules:

Message Patterns

Request-Response Pattern

Message Queuing

Handle message queuing for reliable delivery:

Message Metadata

Envelope Information

Every message can include envelope metadata:

Custom Metadata

Add custom metadata to messages:

Message Serialization

JSON Serialization

Messages are automatically serialized to JSON:

Binary Serialization

For binary data, use base64 encoding:

Message Flow Control

Credit-Based Flow Control

HAIP uses credit-based flow control to manage message flow:

Message Prioritization

Implement message prioritization:

Message Testing

Mock Message Testing

Message Validation Testing

Next Steps

Client API

Learn about the client interface and methods.

Examples

See practical examples of messaging usage.

Flow Control

Understand flow control and back-pressure management.

API Reference

Full API reference documentation.