Overview
Glass provides built-in multiplayer collaboration capabilities, allowing teams to work together in real-time on the same codebase. The collaboration system is built on a robust client-server architecture with conflict-free editing and awareness features.User System
User Representation
- User ID: Unique identifier for the user
- GitHub Login: GitHub username for authentication
- Avatar: Profile picture URI
- Display Name: Optional friendly name
Collaborator Information
Network Identity
- Peer ID for network communication
- Replica ID for conflict-free editing
Git Integration
- Committer name and email
- Host status for session ownership
Contact Management
Contact System
Manage your professional network within Glass:Contact Request Flow
Contact Events
- New contact requests
- Accepted contact requests
- Cancelled requests
Real-Time Collaboration
Participant Tracking
- User Store
- Presence
The
UserStore maintains:- All users by ID and GitHub login
- Participant indices for each user
- Online/offline status
- Busy status indicators
Cursor and Selection Sharing
See collaborators’ cursors and selections in real-time:- Each collaborator has a unique color
- Cursor positions update as collaborators type
- Selection ranges are highlighted
- Collaborator names appear next to cursors
Collaborator cursor display can be controlled with the
DisplayCursorNames action in the editor.Project Sharing
Project Collaboration
- Host Controls: Project host manages permissions
- Participant Indices: Unique index for each participant
- Project Synchronization: Files and changes sync automatically
Shared Editing
The collaboration system provides:- Conflict-Free Editing: Operational transformation ensures edits don’t conflict
- Replica IDs: Each editor instance has a unique replica ID for tracking changes
- Automatic Merging: Changes from multiple users merge seamlessly
Network Architecture
Client-Server Communication
Glass uses a client-server architecture:Client
- Manages local editor state
- Sends operations to server
- Receives and applies remote operations
- Handles presence updates
Server
- Routes operations between clients
- Maintains authoritative state
- Manages user authentication
- Tracks active sessions
Protocol
Communication uses theproto protocol:
User Management
User Store Events
- Contact-related changes
- Participant changes in active sessions
- User profile updates
- Subscription plan changes
Organization Support
- Organization membership tracking
- Organization-specific plans
- Team-wide collaboration features
Privacy and Permissions
Access Control
Privacy features:- Contact-Based: Only contacts can collaborate
- Invitation System: Explicit invitations required for project access
- Host Controls: Project host can remove participants
Status Management
Control your availability:- Online Status: Automatically tracked when app is active
- Busy Status: Set busy to indicate focus time
- Offline Mode: Work without broadcasting presence
Best Practices
Effective Collaboration
Performance Considerations
- Collaboration works best with stable internet connections
- Large files may have slight latency in synchronization
- The system automatically handles network interruptions and reconnections
Integration with Features
Collaborative Editing
Collaboration integrates with core editor features:- Multi-Cursor Awareness: See all collaborators’ cursors
- Selection Sharing: View what others have selected
- Git Integration: Committer information tracked per user
- Language Server: Shared diagnostics and code actions
Future Enhancements
The collaboration system is designed to support:- Voice and video integration
- Shared terminal sessions
- Collaborative debugging
- Team-wide extension sharing