Overview
Events are the primary way your app receives data from the glasses. All event handlers are accessed throughsession.events.
Available Events
Transcription Events
TranscriptionData fields
text: The transcribed textisFinal: Whether this is a final or interim resulttranscribeLanguage: Language code (e.g., ‘en-US’)startTime: Timestamp when speech startedendTime: Timestamp when speech endedconfidence: Confidence score (0-1)provider: Transcription provider used
Button Events
ButtonPress fields
buttonId: Button identifier (e.g., ‘main’)pressType: ‘short’ or ‘long’
Head Position Events
Photo Events
Location Events
Phone Notifications
Connection Events
Event Patterns
Debouncing Events
State Machines
Event Filtering
Multi-User Events
For apps that support multiple users:Best Practices
Clean up event handlers
Clean up event handlers
Event handlers are automatically cleaned up when the session ends, but you can manually remove them:
Handle errors gracefully
Handle errors gracefully
Combine multiple events
Combine multiple events
Performance Tips
- Filter events early: Return early from handlers if the event isn’t relevant
- Debounce rapid events: Use timeouts to batch rapid events
- Avoid blocking operations: Use async/await for long-running tasks
- Clean up resources: Remove handlers and clear timers when done