Skip to main content

Speaking the Same Language: Message Types

In MentraOS Cloud, everything happens through messages. Think of them as the conversations between glasses, cloud, and apps. Let’s learn the language!

The Four Conversations

There are four main conversations happening:
  1. Glasses → Cloud (What the glasses tell us)
  2. Cloud → Glasses (What we tell the glasses)
  3. Apps → Cloud (What apps ask us to do)
  4. Cloud → Apps (What we tell the apps)
All message types are defined in packages/sdk/src/types/message-types.ts.

Conversation 1: Glasses → Cloud

These messages come from the mobile app (remember, it’s the bridge between glasses and cloud). Types are defined in packages/sdk/src/types/messages/glasses-to-cloud.ts:

Connection Messages

User Actions

App Control

Media Events

System Updates

Location Updates

Conversation 2: Cloud → Glasses

These messages tell the glasses what to do:

Connection Management

Display Updates

Media Requests

Settings Updates

Conversation 3: Apps → Cloud

Apps use these messages to interact with the system:

Connection Setup

Display Requests

Media Requests

Conversation 4: Cloud → Apps

The cloud sends these to apps:

Connection Management

Data Streams

This is the main way apps receive data. Stream types are defined in packages/sdk/src/types/streams.ts:

System Updates

Message Flow Example

Let’s trace a message through the system when Alex says “What’s the weather?”:
  1. Glasses capture audio → Send audio data to cloud
  2. Cloud transcribes → “What’s the weather?”
  3. Cloud finds subscribers → Weather app is subscribed to transcriptions
  4. Cloud sends to app:
  5. App processes → Fetches weather data
  6. App responds:
  7. Cloud validates → Checks rate limits, formats display
  8. Cloud sends to glasses:
  9. Alex sees the weather on their glasses display!

Important Patterns

Request-Response Pattern

Some messages have a request ID for tracking:
  • App sends PHOTO_REQUEST with requestId: "photo-123"
  • Cloud forwards to glasses
  • Glasses respond with PHOTO_TAKEN with same requestId
  • Cloud matches response to request and sends to app

Subscription Pattern

Apps don’t get all data, only what they subscribe to. Available stream types (from packages/sdk/src/types/streams.ts): Hardware Streams:
  • button_press - Button press events
  • head_position - Head up/down position
  • location_update - GPS location updates
  • vps_coordinates - Visual positioning system data
Audio Streams:
  • transcription - Speech-to-text results
  • translation - Real-time translation
  • VAD - Voice activity detection
  • audio_chunk - Raw audio data
Phone Streams:
  • phone_notification - Incoming notifications
  • phone_notification_dismissed - Notification dismissals
  • calendar_event - Calendar updates
System Streams:
  • start_app - App start requests
  • stop_app - App stop requests
  • core_status_update - System status
Media Streams:
  • photo_taken - Photo capture events
  • rtmp_stream_status - RTMP streaming status
  • managed_stream_status - Managed streaming status

Fire-and-Forget Pattern

Some messages don’t expect responses:
  • Display updates just happen
  • Settings updates are applied silently
  • Status updates are informational

What’s Next?

Now you understand the language of MentraOS! Next, let’s see how apps connect and use these messages to create amazing experiences.