Build real-time multiplayer experiences in minutes

Open-source SDK for multiplayer games, collaborative whiteboards, video chat, and any app that needs instant communication between users.

End-to-End Encryption by Default
JavaScript (Web)
Java (Desktop/Server)
Python (Scripts/Bots)
C++ (Games)
๐ŸŽจ Try Whiteboard Demo โœจ Try New UI In Progress
๐Ÿ’ Air Hockey ๐Ÿ“ Quick Share

โœจ No login required ยท Play with friends in real-time

Quick Links

๐Ÿš€ Quick Start โ€” 3 Steps

1
Include the SDK
<!-- Add to your HTML -->
<script src="web-agent.libs.js"></script>
<script src="web-agent.js"></script>

<!-- Optional: For WebRTC (video/audio/screen sharing) -->
<script src="web-agent.webrtc.js"></script>
2
Connect to a Channel
const agent = new AgentConnection();

agent.connect({
  channelName:     'my-room',
  channelPassword: 'secret123',
  agentName:       'player-1',
  api:             'https://hmdevonline.com/messaging-platform/api/v1/messaging-service',
  apiKey:          'your-api-key'
});
3
Send & Receive Messages
// Simple text message
agent.sendTextMessage('Hello, World!');

// Object format (for advanced options)
agent.sendMessage({
  content:    'Hello, World!',
  type:       'chat-text',
  to:         'player-2'  // Optional: specific agent
});

// Receive messages
agent.onMessage = (msg) => {
  console.log(msg.content);
};
๐Ÿ“š Full Documentation โ†’
โญ FEATURED
๐ŸŽจ

Collaborative Whiteboard

Draw together in real-time. Excalidraw-inspired design with instant sync. Perfect for brainstorming, teaching, or creative sessions.

  • 2-20 users simultaneously
  • Drawing tools & colors
  • Pan, zoom, undo/redo
  • Shareable room links
Try Whiteboard Demo
โญ FEATURED
๐Ÿ“

Quick Share

P2P file sharing via WebRTC DataChannels. Share files directly between browsers with no server storage. Fast, secure, and encrypted end-to-end.

  • Up to 100MB file transfers
  • DTLS encryption (P2P)
  • Real-time progress tracking
  • Multi-peer file sharing
Try Quick Share
โญ FEATURED
๐Ÿ’ฌ

Real-Time Chat PUBLIC API

Full-featured chat with channels, encrypted sharing, and mobile support.

  • Real-time messaging
  • Multi-agent connectivity
  • QR code room sharing
Open Chat Demo
๐Ÿงช EXPERIMENTAL
๐Ÿ“น

WebRTC Video PUBLIC API

Video calls with P2P connections. Camera and screen sharing support.

  • Peer-to-peer video
  • Screen sharing
  • TURN/STUN support
Open Video Demo
๐Ÿ”ง

Connection Tester

Diagnose WebRTC connectivity. Test TURN/STUN servers and ICE candidates.

  • Test server connectivity
  • Verify ICE candidates
  • Debug connection issues
Open Test Tool
๐Ÿ’พ

Channel Storage

Persistent key-value storage for channels. Store game state and settings.

  • PUT/GET/DELETE/LIST
  • Survives across sessions
  • Perfect for game saves
Open Storage Demo
๐Ÿ‘จโ€๐Ÿ’ป

Developer Portal

Manage API keys, channels, view usage stats, and access testing tools.

  • API key management
  • Channel management
  • Usage monitoring
Open Developer Portal

Looking for more examples?

๐ŸŽฎ Check out Mini-Games โ†’

๐Ÿ—๏ธ System Architecture Overview

The Messaging Platform is a real-time communication system that enables agents (clients) to exchange messages through channels. It supports multiple protocols (HTTP, WebSocket, UDP) and provides features like encryption, WebRTC relay, channel isolation, and ephemeral messaging. The system includes a DB Persistence Layer for session management and a Caching Layer for high-performance operations.

๐Ÿ“Š HIGH-LEVEL ARCHITECTURE MESSAGING PLATFORM Web Agent (Browser) Java Agent (Desktop) Python Agent (Scripts) C++ Agent (Games) API Gateway (Load Balancing / Auth) Messaging Service (Channels / Ephemeral Msgs) Kafka Service (Events / Message Broker) Other Services (Extensible) DB Persistence Layer (Sessions / Channels) Caching Layer (High-Performance)

๐Ÿ”‘ API Key System

The platform uses a flexible API key system with two types of keys for different security requirements.

Original API Key vs Temporary API Key

๐Ÿ” API KEY ARCHITECTURE
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                           API KEY SYSTEM                                         โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                                  โ”‚
โ”‚   ORIGINAL API KEY (Developer Key)                                             โ”‚
โ”‚   โ”œโ”€โ”€ Permanent key issued to developer                                         โ”‚
โ”‚   โ”œโ”€โ”€ Full access to all features                                               โ”‚
โ”‚   โ”œโ”€โ”€ Used for server-side applications                                         โ”‚
โ”‚   โ””โ”€โ”€ Should be kept SECRET (never expose to clients)                           โ”‚
โ”‚                                                                                  โ”‚
โ”‚                          โ”‚                                                       โ”‚
โ”‚                          โ–ผ                                                       โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”              โ”‚
โ”‚   โ”‚              TEMPORARY KEY SERVICE                          โ”‚              โ”‚
โ”‚   โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚              โ”‚
โ”‚   โ”‚  โ”‚  โ€ข Creates short-lived keys from original key          โ”‚  โ”‚              โ”‚
โ”‚   โ”‚  โ”‚  โ€ข Sets expiration time (e.g., 1 hour, 24 hours)       โ”‚  โ”‚              โ”‚
โ”‚   โ”‚  โ”‚  โ€ข Restricts capabilities (read-only, specific events) โ”‚  โ”‚              โ”‚
โ”‚   โ”‚  โ”‚  โ€ข Limits to specific agent names                      โ”‚  โ”‚              โ”‚
โ”‚   โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚              โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜              โ”‚
โ”‚                          โ”‚                                                       โ”‚
โ”‚                          โ–ผ                                                       โ”‚
โ”‚   TEMPORARY API KEY (Client Key)                                               โ”‚
โ”‚   โ”œโ”€โ”€ Short-lived (expires automatically)                                       โ”‚
โ”‚   โ”œโ”€โ”€ Limited capabilities                                                      โ”‚
โ”‚   โ”œโ”€โ”€ Safe for client-side applications                                         โ”‚
โ”‚   โ””โ”€โ”€ If compromised, expires soon anyway                                       โ”‚
โ”‚                                                                                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ’ก WHEN TO USE EACH:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         Original API Key          โ”‚              Temporary API Key              โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โœ“ Server-side applications       โ”‚ โœ“ Web browsers (JavaScript)                  โ”‚
โ”‚ โœ“ Backend services               โ”‚ โœ“ Mobile apps                                โ”‚
โ”‚ โœ“ Trusted environments           โ”‚ โœ“ Untrusted clients                          โ”‚
โ”‚ โœ“ Full feature access needed     โ”‚ โœ“ Limited feature access OK                  โ”‚
โ”‚ โœ— Never in client-side code      โ”‚ โœ“ Safe to expose in client code              โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Temporary Key Flow

1

Server Creates Temporary Key

Your backend server uses the original API key to create a temporary key with specific restrictions.

2

Client Receives Temporary Key

The temporary key is sent to the client (browser, mobile app). It's safe to transmit over the network.

3

Client Connects to Channel

The client uses the temporary key to connect. The platform validates it and applies restrictions.

4

Key Expires Automatically

After the expiration time, the key stops working. Client needs a new temporary key to continue.

๐ŸŒ API Key Scope - Channel Isolation

The apiKeyScope parameter controls how channels are isolated between different developers. This is crucial for both security (production) and convenience (testing).

๐Ÿ”’ PRIVATE SCOPE (Default) - Channel Isolation Developer A API Key: "key-AAA" Developer B API Key: "key-BBB" agent.connect({ channelName: "lobby", channelPassword: "pass123", agentName: "player-1", apiKey: "key-AAA", apiKeyScope: "private" agent.connect({ channelName: "lobby", channelPassword: "pass123", agentName: "player-1", apiKey: "key-BBB", apiKeyScope: "private" Channel ID Generated: hash("lobby"+"pass"+"AAA") = "ch_abc..." Channel ID Generated: hash("lobby"+"pass"+"BBB") = "ch_xyz..." CHANNEL A (Isolated) Dev A only CHANNEL B (Isolated) Dev B only โœ— NO CONNECTION โš ๏ธ Same channelName + password BUT different apiKey = SEPARATE channels! โœ“ Use for: Production apps, multi-tenant systems, security isolation

๐ŸŒ API Key Scope - Shared Channels

The apiKeyScope parameter controls how channels are isolated between different developers. This is crucial for both security (production) and convenience (testing).

๐ŸŒ PUBLIC SCOPE - Shared Channels Developer A API Key: "key-AAA" Developer B API Key: "key-BBB" agent.connect({ channelName: "test-room", channelPassword: "demo", agentName: "tester-1", apiKey: "key-AAA", apiKeyScope: "public" agent.connect({ channelName: "test-room", channelPassword: "demo", agentName: "tester-2", apiKey: "key-BBB", apiKeyScope: "public" Channel ID Generated: hash("test-room"+"demo"+PUBLIC) Channel ID Generated: hash("test-room"+"demo"+PUBLIC) SAME! SHARED CHANNEL tester-1 (Dev A) tester-2 (Dev B) โœ“ CONNECTED! โœ“ Same channelName + password + PUBLIC scope = SAME channel! โœ“ Use for: Testing, demos, SDK examples, team collaboration

When to Use Each Scope

๐Ÿ”’ Private Scope (Default)

  • Production applications
  • Multi-tenant systems
  • When user data must be isolated
  • Billing/metering per developer
  • Security-sensitive applications

๐ŸŒ Public Scope

  • Testing with teammates
  • SDK examples and demos
  • Cross-developer collaboration
  • Public game lobbies
  • Community features

๐Ÿ“ก Connection & Message Flow

Understanding how agents connect and exchange messages through the platform.

๐Ÿ”„ CONNECTION FLOW CLIENT (Agent) MESSAGING SVC DB LAYER (Persistence) 1. POST /connect channelName: "game" channelPassword: "secret" agentName: "player-1" apiKey: "key-123" 2. Validate API Key โœ“ 3. Generate Channel ID 4. Create Session Session Created 5. Response sessionId: "sess_xyz" channelId: "ch_abc" โœ“ Connected!

๐Ÿ“ฆ Three-Layer Messaging Architecture

The platform uses a sophisticated three-layer storage system to optimize message delivery for different use cases. Messages flow through Cache for instant access, Kafka for reliable message brokering, and Database for permanent persistence.

๐Ÿ—„๏ธ MESSAGE STORAGE LAYERS THREE-LAYER MESSAGE STORAGE Layer 1: CACHE โšก Ultra-fast in-memory storage โฑ๏ธ Recent messages (last ~1000 per channel) ๐ŸŽฎ Perfect for: Real-time gaming, live updates โš ๏ธ Limited retention (messages expire after time) Layer 2: KAFKA (Message Broker) ๐Ÿ“จ High-throughput message broker ๐Ÿ“ˆ Scales horizontally for high throughput ๐Ÿ”„ Perfect for: Real-time delivery, event streaming โš ๏ธ Has retention limits (not permanent storage) Layer 3: DATABASE (Permanent Storage) ๐Ÿ’พ Permanent message persistence ๐Ÿ“Š Indexed for efficient queries ๐Ÿ” Perfect for: Audit trails, history, compliance โ™พ๏ธ Long-term storage (source of truth) Read Priority (AUTO mode): Cache โ†’ Kafka โ†’ Database

๐Ÿ“ค Message Send Flow

When an agent sends a regular (persistent) message, it flows through all three layers:

1

Message Sent to Service

Agent sends message via HTTP/WebSocket/UDP to the messaging service.

2

Written to Cache

Message is immediately cached in memory for fast access. Limited retention time (TTL-based).

3

Published to Kafka

Message is published to Kafka for reliable delivery and event streaming. Has retention limits (not permanent).

4

Persisted to Database

Message is saved to the database for permanent storage, structured querying, and long-term audit trails.

๐Ÿ“ฅ Message Receive with pollSource

The pollSource parameter lets you control which layer(s) to read from. This is crucial for optimizing performance based on your use case.

๐ŸŽฏ pollSource OPTIONS
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                          pollSource VALUES                                       โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                                  โ”‚
โ”‚  AUTO (Default - Recommended)                                                   โ”‚
โ”‚  โ”œโ”€โ”€ Tries all layers in order: Cache โ†’ Kafka โ†’ Database                        โ”‚
โ”‚  โ”œโ”€โ”€ Falls back automatically if a layer has no data                            โ”‚
โ”‚  โ”œโ”€โ”€ Best for: General purpose, balanced performance                            โ”‚
โ”‚  โ””โ”€โ”€ ๐Ÿ’ก Smartly optimizes between speed and completeness                        โ”‚
โ”‚                                                                                  โ”‚
โ”‚  CACHE (Ultra-Fast Mode)                                                         โ”‚
โ”‚  โ”œโ”€โ”€ Reads ONLY from in-memory cache                                            โ”‚
โ”‚  โ”œโ”€โ”€ Fastest possible response time (< 1ms typical)                             โ”‚
โ”‚  โ”œโ”€โ”€ Best for: Real-time gaming, live updates, high-frequency polling           โ”‚
โ”‚  โ”œโ”€โ”€ โš ๏ธ Warning: May miss messages not yet cached or already expired            โ”‚
โ”‚  โ””โ”€โ”€ ๐ŸŽฎ Use case: Air Hockey game, cursor tracking, live player positions       โ”‚
โ”‚                                                                                  โ”‚
โ”‚  KAFKA (Message Broker Mode)                                                    โ”‚
โ”‚  โ”œโ”€โ”€ Reads ONLY from Kafka message broker                                       โ”‚
โ”‚  โ”œโ”€โ”€ Access to recent message stream (has retention limits)                     โ”‚
โ”‚  โ”œโ”€โ”€ Best for: Event streaming, real-time delivery, recent history              โ”‚
โ”‚  โ”œโ”€โ”€ โš ๏ธ Note: Not permanent - messages expire after retention period            โ”‚
โ”‚  โ””โ”€โ”€ ๐Ÿ“จ Use case: Live event streaming, recent message replay                   โ”‚
โ”‚                                                                                  โ”‚
โ”‚  DATABASE (Permanent Storage Mode)                                             โ”‚
โ”‚  โ”œโ”€โ”€ Reads ONLY from database (permanent storage)                               โ”‚
โ”‚  โ”œโ”€โ”€ Access to complete, permanent message history                              โ”‚
โ”‚  โ”œโ”€โ”€ Best for: Audit trails, compliance, historical queries, analytics          โ”‚
โ”‚  โ”œโ”€โ”€ โ™พ๏ธ Source of truth - messages stored permanently                           โ”‚
โ”‚  โ””โ”€โ”€ ๐Ÿ” Use case: Compliance reporting, audit logs, data analysis               โ”‚
โ”‚                                                                                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ’ก HOW TO USE pollSource:

JavaScript:
agent.connect({
    channelName: 'game-room',
    channelPassword: 'secret',
    agentName: 'Player-1',
    pollSource: 'CACHE'  // Set default for all receives
});

// All receives use CACHE automatically
agent.receive(range);  // Uses CACHE

// Override per-request if needed
agent.receive({...range, pollSource: 'KAFKA'});

Python:
agent.connect(
    channel_name='game-room',
    channel_password='secret',
    agent_name='Player-1',
    poll_source='CACHE'  # Set default
)

# Receives use CACHE by default
agent.receive(session_id, config)

C++:
api.connect(
    "game-room",
    "secret",
    "Player-1",
    "",        // sessionId
    "",        // channelId
    false,     // enableWebrtcRelay
    "private", // apiKeyScope
    "CACHE"    // pollSource
);

api.receive(sessionId, config);  // Uses CACHE

๐ŸŽฎ Real-World Example: Gaming vs Audit

๐ŸŽฎ

Gaming Scenario - Ultra-Low Latency

Use pollSource: 'CACHE' - Air Hockey game needs to update paddle positions 60 times per second. Cache-only polling provides sub-millisecond response times, perfect for real-time gameplay.

๐Ÿ”

Audit Scenario - Permanent History

Use pollSource: 'DATABASE' - Compliance system needs to retrieve all chat messages from last month. Database provides complete, permanent message history for regulatory reporting and audit trails.

๐Ÿ“จ

Event Streaming - Recent Messages

Use pollSource: 'KAFKA' - Real-time event streaming for recent activity feeds. Kafka provides high-throughput access to recent messages within the retention period.

๐Ÿ“Š

General Chat - Balanced Approach

Use pollSource: 'AUTO' - Normal chat application benefits from the automatic fallback. Recent messages come from cache (fast), then Kafka, with database as the permanent backup.

๐Ÿš€ Future Enhancement

Channel-level capabilities will eventually control storage behavior per channel, allowing fine-grained control over which layers are used for different types of channels (e.g., ephemeral-only channels, audit channels, etc.).

โšก Ephemeral Message Flow

Ephemeral messages provide low-latency, non-persistent communication ideal for real-time updates like player positions, cursor movements, or live status changes.

1

Agent Sends Ephemeral Message

Message is sent with ephemeral: true flag. The message is not stored in the database and is only held in memory.

2

Service Routes to Connected Agents

The messaging service immediately delivers the message to all connected agents in the channel without persistence overhead.

3

Message Discarded After Delivery

Once delivered, ephemeral messages are discarded. Agents that join later will not receive historical ephemeral messages.

๐Ÿ’ก

Use Cases for Ephemeral Messages

Player positions in games, cursor movements in collaborative tools, live typing indicators, real-time sensor data, and other high-frequency updates that don't need persistence.

๐Ÿ”Œ Protocol Support

The platform supports multiple communication protocols for different use cases.

๐Ÿ“ถ SUPPORTED PROTOCOLS
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                           TRANSPORT PROTOCOLS                                    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                                  โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚      HTTP/REST       โ”‚   โ”‚     WebSocket        โ”‚   โ”‚        UDP          โ”‚    โ”‚
โ”‚  โ”‚      โœ… STABLE       โ”‚   โ”‚   ๐Ÿšง IN PROGRESS    โ”‚   โ”‚   ๐Ÿšง IN PROGRESS    โ”‚    โ”‚
โ”‚  โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค   โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค    โ”‚
โ”‚  โ”‚ โ€ข Request/Response  โ”‚   โ”‚ โ€ข Persistent conn   โ”‚   โ”‚ โ€ข Low latency       โ”‚    โ”‚
โ”‚  โ”‚ โ€ข Reliable delivery โ”‚   โ”‚ โ€ข Real-time push    โ”‚   โ”‚ โ€ข Unreliable        โ”‚    โ”‚
โ”‚  โ”‚ โ€ข Long polling      โ”‚   โ”‚ โ€ข Auto-reconnect    โ”‚   โ”‚ โ€ข Best for games    โ”‚    โ”‚
โ”‚  โ”‚ โ€ข Works everywhere  โ”‚   โ”‚ โ€ข Efficient         โ”‚   โ”‚ โ€ข Position updates  โ”‚    โ”‚
โ”‚  โ”‚ โ€ข Production ready  โ”‚   โ”‚ โ€ข Coming soon...    โ”‚   โ”‚ โ€ข Coming soon...    โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚           โ”‚                         โ”‚                         โ”‚                  โ”‚
โ”‚           โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚                  โ”‚
โ”‚           โ””โ”€โ”€โ”€โ”€โ”ค                    โ”‚                    โ”œโ”€โ”€โ”€โ”€โ”˜                  โ”‚
โ”‚                โ”‚          AGENT SDK                    โ”‚                       โ”‚
โ”‚                โ”‚   (Automatically selects best protocol) โ”‚                       โ”‚
โ”‚                โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                       โ”‚
โ”‚                                                                                  โ”‚
โ”‚  CURRENT STATUS:                                                               โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚ โœ… HTTP/REST   - Fully supported, production ready                       โ”‚    โ”‚
โ”‚  โ”‚ ๐Ÿšง WebSocket   - In development, basic support available                 โ”‚    โ”‚
โ”‚  โ”‚ ๐Ÿšง UDP         - In development, experimental support                    โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                                                                                  โ”‚
โ”‚  USE CASE RECOMMENDATIONS:                                                    โ”‚
โ”‚                                                                                  โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚  โ”‚ Chat Apps        โ†’ HTTP (polling) - stable, WebSocket coming soon       โ”‚    โ”‚
โ”‚  โ”‚ Multiplayer Games โ†’ HTTP now, UDP support coming for fast updates        โ”‚    โ”‚
โ”‚  โ”‚ IoT Devices      โ†’ HTTP (simple, reliable)                              โ”‚    โ”‚
โ”‚  โ”‚ Web Browsers     โ†’ HTTP (stable) or WebSocket (when available)         โ”‚    โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚                                                                                  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“น WebRTC Integration

The platform provides signaling support for WebRTC peer-to-peer connections.

๐ŸŽฅ WEBRTC SIGNALING FLOW
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚     Browser A       โ”‚              โ”‚ MESSAGING CHANNELโ”‚             โ”‚     Browser B       โ”‚
โ”‚  agentName: "alice" โ”‚              โ”‚  (Signaling)    โ”‚              โ”‚  agentName: "bob"   โ”‚
โ”‚  (Caller)           โ”‚              โ”‚              โ”‚  (Callee)           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
           โ”‚                                  โ”‚                                  โ”‚
           โ”‚  Both connected to same channel: โ”‚                                  โ”‚
           โ”‚  channelName: "video-room"       โ”‚                                  โ”‚
           โ”‚  channelPassword: "secret"       โ”‚                                  โ”‚
           โ”‚  apiKey: "key-123"               โ”‚                                  โ”‚
           โ”‚                                  โ”‚                                  โ”‚
           โ”‚  1. Create Offer (SDP)           โ”‚                                  โ”‚
           โ”‚  send({to: "bob", type: WEBRTC}) โ”‚                                  โ”‚
           โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚                                  โ”‚
           โ”‚                                  โ”‚  2. Relay Offer to "bob"         โ”‚
           โ”‚                                  โ”‚โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚
           โ”‚                                  โ”‚                                  โ”‚
           โ”‚                                  โ”‚  3. Create Answer (SDP)          โ”‚
           โ”‚                                  โ”‚  send({to: "alice", type: WEBRTC})
           โ”‚                                  โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚
           โ”‚  4. Relay Answer to "alice"      โ”‚                                  โ”‚
           โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚                                  โ”‚
           โ”‚                                  โ”‚                                  โ”‚
           โ”‚  5. Exchange ICE Candidates      โ”‚                                  โ”‚
           โ”‚  (via channel messages)          โ”‚                                  โ”‚
           โ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บโ”‚
           โ”‚                                  โ”‚                                  โ”‚
           โ”‚                                                                     โ”‚
           โ”‚  โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ”‚
           โ”‚                     6. DIRECT P2P CONNECTION                      โ”‚
           โ”‚                     (Video/Audio Stream)                            โ”‚
           โ”‚                     No server involved!                             โ”‚
           โ”‚โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ”‚
           โ”‚                                                                     โ”‚

โœ“ The messaging channel is only used for signaling - actual media flows directly P2P!
โœ“ Use agentName to target specific peer for WebRTC offers/answers

๐Ÿ“‹ Quick Reference

๐Ÿš€ CONNECT API - ALL OPTIONS
// JavaScript Example - All Connection Options
const agent = new AgentConnection();

agent.connect({
    // Required
    channelName: 'my-channel',        // Channel name
    channelPassword: 'secret123',      // Channel password (hashed automatically)
    agentName: 'player-1',             // Your agent identifier

    // API Key Options
    apiKey: 'your-api-key',            // Original or Temporary API key
    apiKeyScope: 'private',            // 'private' (default) or 'public'

    // Optional Features
    autoReceive: true,                 // Auto-poll for messages
    useWebsocket: true,                // Use WebSocket if available
    enableWebrtcRelay: false,          // Enable WebRTC signaling relay

    // Advanced
    sessionId: null,                   // For reconnection
    channelId: null,                   // Pre-computed channel ID
    customEventType: 'game,chat'       // Filter specific event types
});

// EVENT HANDLERS
agent.onMessage = (msg) => console.log('Received:', msg);
agent.onConnect = () => console.log('Connected!');
agent.onDisconnect = () => console.log('Disconnected');
agent.onError = (err) => console.error('Error:', err);

๐ŸŽฎ Mini-Games

Interactive multiplayer games built with the Messaging Platform SDK. These examples demonstrate real-time communication, WebRTC peer-to-peer networking, physics synchronization, and game state management.

โญ FEATURED
๐Ÿ’

Air Hockey

Classic 2-player air hockey game with realistic physics. Use your paddle to hit the puck into your opponent's goal. Perfect showcase of real-time P2P gameplay!

  • 2-player competitive gameplay
  • Realistic physics engine
  • Score tracking & animations
  • Ultra-low latency P2P
Play Air Hockey
โญ FEATURED
โ“

Quiz Battle

Multiplayer trivia quiz game. Answer questions quickly to earn points. Compete with friends across multiple categories with real-time scoring.

  • 2-8 players simultaneously
  • Multiple quiz categories
  • Real-time scoring
  • Timed questions
  • Leaderboard
Play Quiz Battle
๐Ÿšง COMING SOON
โšก

4-Player Reactor

Fast-paced 4-player reaction game. Compete to click targets as quickly as possible. Test your reflexes and compete for the best reaction times!

  • 4 players real-time competition
  • Reaction time tracking
  • Multiple game modes
  • Visual & audio cues
  • High score system
๐Ÿงช EXPERIMENTAL
๐Ÿคฅ

Find the Liar

Social deduction party game where players answer questions about a secret item. Liars get hints while others know the truth. Vote to catch the liar!

  • 3-10 players party game
  • Multiple liars support
  • Vote threshold mechanics
  • 80 items & 30 questions
  • Liar celebration effects
Play Find the Liar
๐Ÿ†• NEW
๐ŸŽ‰

Party Physics Brawl

Multiplayer physics-based party game! Battle with unique characters in arenas. Host-authoritative with Rapier physics and Three.js graphics.

  • 2-8 players real-time combat
  • 5 unique character archetypes
  • Fight Mode (MVP complete)
  • Mobile touch controls
  • HP & stamina system
Play Party Physics
๐Ÿšง COMING SOON
๐Ÿ

Race Balls

3D racing game with physics-based ball controls. Race against other players through obstacles, boost pads, and checkpoints to reach the finish line first.

  • 2-4 players real-time racing
  • Three.js 3D graphics
  • Physics synchronization
  • Multiple race tracks
  • Boost & stamina system

๐Ÿ”ง Technical Implementation

All games are built using the Messaging Platform SDK with:

๐Ÿ“ก
Real-time Messaging

AgentConnection for player synchronization and game events

๐Ÿ”—
WebRTC P2P

Low-latency peer-to-peer for fast-paced gameplay (10-30ms)

๐ŸŽจ
Three.js Graphics

3D rendering, physics simulation, and visual effects

๐Ÿ’พ
Channel Storage

Persistent game state, leaderboards, and player progress

๐Ÿ’ป Code Examples

Quick code snippets to get you started with the Messaging Platform SDK. For complete documentation, visit the User Guide.

๐Ÿ”Œ Basic Connection

JavaScript (Web Agent)

// Include SDK files
<script src="js/web-agent.libs.js"></script>
<script src="js/web-agent.js"></script>

// Create connection
const agent = new AgentConnection();

// Connect to channel
agent.connect({
    channelName:     'my-game-lobby',
    channelPassword: 'secure-password',
    agentName:       'player-1',
    api:             'https://hmdevonline.com/messaging-platform/api/v1/messaging-service',
    apiKey:          'your-api-key',
    autoReceive:     true
});

// Handle messages
agent.onMessage = (msg) => {
    console.log('Received:', msg.content);
};

// Send message
agent.sendTextMessage('Hello, World!');

Java Agent

import com.hmdev.messaging.agent.core.AgentConnection;

AgentConnection agent = new AgentConnection(
    "https://hmdevonline.com/messaging-platform/api/v1/messaging-service",
    "your-api-key"
);

agent.connect("my-game-lobby", "player-1", "secure-password");
agent.sendMessage("Hello, World!");
agent.disconnect();

Python Agent

from messaging_agent import AgentConnection

agent = AgentConnection(
    api_url="https://hmdevonline.com/messaging-platform/api/v1/messaging-service",
    api_key="your-api-key"
)

agent.connect("my-game-lobby", "player-1", "secure-password")
agent.send_message("Hello, World!")
agent.disconnect()

๐Ÿ’ฌ Sending Messages

Simple Text Message

// Quick way to send text
agent.sendTextMessage('Hello, World!');

Object Format (Full Control)

// Send with all options
agent.sendMessage({
    content:    'Hello, World!',
    type:       'chat-text',        // Message type (default: 'chat-text')
    to:         'player-2',         // Target specific agent (optional)
    ephemeral:  false               // Non-persistent message (optional)
});

// Broadcast to all agents
agent.sendMessage({
    content: 'Game started!',
    type:    'game-event'
});

// Send to specific agent
agent.sendMessage({
    content: 'Private message',
    to:      'player-2'
});

// Use filter (regex pattern)
agent.sendMessage({
    content: 'Team message',
    filter:  'team-.*'              // Matches team-red, team-blue, etc.
});

Custom Message Types

// Game state update
agent.sendMessage({
    content: JSON.stringify({
        position: { x: 10, y: 20 },
        health:   100
    }),
    type:    'game-state'
});

// Player action
agent.sendMessage({
    content: JSON.stringify({ action: 'jump' }),
    type:    'player-action'
});

// Ephemeral message (not stored)
agent.sendMessage({
    content:   'Typing...',
    type:      'typing-indicator',
    ephemeral: true
});

๐Ÿ“น WebRTC Peer-to-Peer

Setup WebRTC Helper

// Include WebRTC support
<script src="js/web-agent.webrtc.js"></script>

// Create WebRTC helper (after connecting agent)
const webrtc = new WebRTCHelper(agent);

// Handle incoming data
webrtc.onDataReceived = (data, peerId) => {
    console.log('Received from', peerId, ':', data);
};

// Send data to all peers
webrtc.sendData({
    type:     'game-state',
    position: { x: 10, y: 20 }
});

// Send to specific peer
webrtc.sendData(data, 'specific-peer-id');

๐Ÿ’พ Channel Storage

Store and Retrieve Data

// Store data
await agent.putStorage(
    'player-score',
    JSON.stringify({ score: 1000 })
);

// Retrieve data
const data  = await agent.getStorage('player-score');
const score = JSON.parse(data);

// Delete data
await agent.deleteStorage('player-score');

// List all keys
const keys = await agent.listStorageKeys();
console.log('Stored keys:', keys);

๐ŸŽฎ Game State Synchronization

Example: Player Position Sync

// Send player position update
function updatePosition(x, y, z) {
    const update = {
        type:      'position',
        playerId:  agent.agentName,
        position:  { x, y, z },
        timestamp: Date.now()
    };

    // Use WebRTC for low latency
    if (webrtc && webrtc.isConnected()) {
        webrtc.sendData(update);
    } else {
        // Fallback to messaging
        agent.sendTextMessage(JSON.stringify(update));
    }
}

// Receive position updates
webrtc.onDataReceived = (data) => {
    if (data.type === 'position') {
        updateRemotePlayer(data.playerId, data.position);
    }
};

๐Ÿ” API Key Scopes

Private vs Public Channels

// PRIVATE scope (default) - isolated per API key
agent.connect({
    channelName:     'production-game',
    channelPassword: 'secure123',
    agentName:       'player-1',
    api:             'https://hmdevonline.com/messaging-platform/api/v1/messaging-service',
    apiKey:          'your-api-key',
    apiKeyScope:     'private'  // Each developer gets separate channel
});

// PUBLIC scope - shared across all API keys
agent.connect({
    channelName:     'test-lobby',
    channelPassword: 'demo',
    agentName:       'tester-1',
    api:             'https://hmdevonline.com/messaging-platform/api/v1/messaging-service',
    apiKey:          'your-api-key',
    apiKeyScope:     'public'  // Anyone with same name+password connects to same channel
});

๐Ÿ“š More Resources

For complete API documentation, detailed guides, and advanced examples:

โœจ Platform Features

Comprehensive real-time communication features for building modern multiplayer applications

Core Communication

๐Ÿ“ก

Real-time Messaging

WebSocket-based messaging with automatic reconnection, message ordering, and delivery guarantees. Support for text, binary, and structured data.

๐Ÿ”—

WebRTC P2P

Ultra-low latency peer-to-peer communication (10-30ms) using WebRTC DataChannels. Perfect for real-time games and interactive applications.

๐Ÿ”

Channel Isolation

Private and public channel scopes with password protection. Flexible API key system with temporary keys for client-side applications.

๐Ÿ’พ

Channel Storage

Persistent key-value storage per channel. Perfect for game state, leaderboards, settings, and any data that needs to survive across sessions.

๐ŸŒ

Multi-Platform SDKs

Consistent API across JavaScript (Web), Java (Desktop), Python (Scripts), and C++ (Games). Write once, deploy everywhere.

๐Ÿ“น

Video/Audio Streaming

WebRTC video and audio streaming with camera, screen sharing, and recording capabilities. Built-in TURN/STUN server support.

Developer Experience

๐Ÿ‘จโ€๐Ÿ’ป

Developer Portal

Web-based dashboard for API key management, channel monitoring, usage statistics, and account settings. No installation required.

๐Ÿ“š

Comprehensive Docs

Detailed documentation with code examples, tutorials, and best practices. Interactive demos and working examples for every feature.

๐Ÿš€

Quick Start

Get started in minutes with simple API design and minimal configuration. Include SDK files, connect to a channel, and start messaging.

๐Ÿ”ง

Debugging Tools

Built-in connection testing, TURN/STUN verification, WebRTC diagnostics, and comprehensive logging for troubleshooting.

๐ŸŽฎ

Game-Ready Examples

Complete multiplayer game examples including racing, air hockey, quiz battle, and more. Learn from production-ready code.

๐Ÿ“ฑ

Mobile Optimized

Responsive design and touch-friendly interfaces. All demos and games work seamlessly on mobile devices and tablets.

๐Ÿ”ฎ

Coming Soon

๐Ÿ“Š Advanced Analytics
๐Ÿ”” Push Notifications
๐Ÿค– Bot SDK
๐ŸŒ Regional Servers
๐Ÿ“ฆ File Sharing
๐Ÿ”’ End-to-End Encryption

๐Ÿ“‹ Current Status

๐Ÿšง

Free Pre-Production Demo

This SDK is currently available as a free demo and pre-production release for exploration, testing, and feedback. The platform is in active development, and APIs, features, and functionality may change as we refine the system.

What This Means:

  • โœ“ The SDK is completely free to use for development and experimentation
  • โœ“ There are no paid plans or pricing commitments at this time
  • โœ“ APIs and features may change as we gather feedback and improve the platform
  • โœ“ This is an excellent opportunity to explore real-time messaging capabilities and provide input
โš ๏ธ

Not Recommended for Production

As this is a pre-production release, we recommend using it for development, testing, and prototyping rather than production deployments. Service availability and data persistence are not guaranteed during this phase.

We're actively working toward a stable production release. If you have questions, feedback, or encounter issues, please reach outโ€”your input helps shape the platform's future.

Current Features & Capabilities

๐Ÿ”Œ
Full SDK Access Web, Java, Python, and C++ SDKs with complete API access
๐Ÿ“ก
Real-Time Messaging Channel-based messaging with encryption and ephemeral support
๐Ÿ“น
WebRTC Integration Signaling support for peer-to-peer connections
๐Ÿ”
Security Features API key management, channel isolation, temporary keys

Approximate Technical Limits (Subject to change)

~100
Agents per channel
~1000
Messages per hour
~10 MB
Storage per channel

These are approximate limits and may be adjusted during development

Ready to Explore?

Request a free API key to start building with the Messaging Platform SDK. No credit card required, and you'll have instant access upon approval.

๐Ÿš€ Platform Roadmap & Future Enhancements

The Messaging Platform is continuously evolving. Here's what's currently implemented, in progress, and planned for the future.

Implemented
In Progress
Planned
๐Ÿ“ก

Multi-Mode Communication Architecture

IN PROGRESS

5 distinct communication modes for developers to choose the optimal architecture for their use case

โœ“ P2P Mesh

Direct peer-to-peer for 2-3 players. Ultra-low latency (10-30ms). SDK complete.

โœ“ P2P Host Mode

Host-based star topology with automatic migration. Perfect for 4-10 players. SDK complete.

โณ WebSocket Relay

Server relay via WebSocket. Firewall-friendly, no WebRTC needed. SDK complete, backend partial.

๐Ÿ“‹ DataChannel Server

Low-latency server validation via DataChannel relay. SDK complete, backend pending.

โœ“ SFU Media

Node.js SFU server ready. Uses SDK's unified WebRtcHelper. Client integration pending.

Developer Benefits: Choose the right mode for your use case. Switch modes without code changes. Same API across all modes.

๐Ÿ”ง

Unified WebRTC Helper

COMPLETE

Single codebase for WebRTC functionality across browser clients and Node.js SFU server

  • โœ“ Supports @roamhq/wrtc and wrtc for Node.js
  • โœ“ SFU relay support via sourceStreamId option
  • โœ“ Browser and Node.js compatibility with single codebase
  • โœ“ Easier maintenance: fix once, applies everywhere
๐ŸŽฎ

Game Server Integration

PLANNED

Allow developers to run authoritative game servers with full control over game logic

Webhook Integration

HTTP POST to developer's server for all game events

WebSocket Connection

Persistent connection for real-time event streaming

Server-Side Agent

Developer's server acts as special relay agent

โœจ

Recent Updates

Latest improvements and additions to the platform

January 31, 2026: NEW API Key Scope Feature

New apiKeyScope parameter for channel isolation. Use "private" (default) for production or "public" for testing/demos.

January 31, 2026: NEW Architecture Diagrams

Added SVG architecture diagrams: System Overview, API Key System, Private/Public Scope visualization, Connection Flow, and Protocol Support status.

January 31, 2026: NEW Temporary API Key Docs

Clarified temporary API keys are optional. Use original API key directly or temporary keys for enhanced client-side security.

January 2026: Multi-Mode Relay Architecture

Added 5 communication modes, unified WebRtcHelper, and Node.js SFU server

January 2026: TURN/STUN Over TLS

Added TCP-TLS relay on port 443 for corporate/VPN environments

January 2026: Developer Console

API key request system with admin approval, email notifications, and developer portal

January 2026: Whiteboard Enhancements

Professional undo/redo system, board locking, zoom controls, and mobile optimization

๐Ÿ’พ

Channel Storage API

PARTIAL

Persistent key-value storage for channels. Store game state, leaderboards, and settings.

โœ“ Web Agent (JS)

Complete implementation with PUT, GET, DELETE, and LIST operations

โณ Java Agent

Coming soon - same API for desktop and server applications

โณ Python Agent

Coming soon - async/await support for bots and scripts

โณ C++ Agent

Coming soon - high-performance game integration

Try it now: Check out the Storage Demo to see the Channel Storage API in action with the Web Agent.

๐Ÿ’ก Have Suggestions?

This platform is evolving based on developer feedback. Request an API key to start building and share your ideas!