Multi-Device and Role Management
Learn about YAT's Actor model and multi-device collaboration mechanism
📋 Table of Contents
- Actor Model Overview
- Role Definitions
- Multi-Device Collaboration
- Session Management
- Device Management
- FAQ
Actor Model Overview
What is Actor Model?
YAT uses Actor model to manage multi-device collaboration. Each device plays a role (Actor) in the tunnel, working together to complete remote access tasks.
Why Need Actor Model?
Scenario Example:
Office computer ──wants to access──► Home Mac
Traditional solution:
- Cannot distinguish who is accessing
- Cannot control permissions
- Confused state
YAT Actor Model:
- Office computer = Consumer
- Home Mac = Publisher
- Clear roles, explicit permissionsIdentity Identification
YAT uses two-layer identity identification:
- Transport Layer Identity:
session_id/device_id - Business Layer Identity:
actor_role/actor_session_id/actor_device_id
Role Definitions
Publisher
Responsibility: Provide remote service
Permissions:
- ✅ Start tunnel
- ✅ Stop tunnel
- ✅ Control channels
- ✅ Modify configuration
Example Scenarios:
- Home Mac provides VNC service
- Company server provides API service
- Local development environment provides debugging service
Consumer
Responsibility: Use remote service
Permissions:
- ✅ View tunnel status
- ✅ Access remote address
- ✅ View detailed information
- ❌ Cannot start/stop tunnel
- ❌ Cannot modify configuration
Example Scenarios:
- Office computer accessing home Mac
- Mobile phone accessing company server
- Customer accessing demo environment
Controller
Responsibility: Manage tunnel configuration (reserved role)
Permissions:
- ✅ All Publisher permissions
- ✅ Manage sharing settings
- ✅ Manage participants
⚠️ Note: Controller role is currently reserved, not yet implemented.
Multi-Device Collaboration
Typical Scenarios
Scenario 1: Remote Work
Home Mac (Publisher)
↓ Create tunnel, share
↓
Office Laptop (Consumer)
↓ Access shared tunnel
↓
Remote desktop connection successfulConfiguration Steps:
Home Mac:
- Create ARD tunnel
- Set to Shared mode
- Role auto-set to Publisher
- Start tunnel
Office Laptop:
- Login to same account
- See shared tunnel in tunnel list
- Role auto-set to Consumer
- Click to connect remote desktop
Scenario 2: Team Collaboration
Developer A (Publisher)
↓ Create API tunnel
↓
Developer B (Consumer)
↓ Access API
↓
Tester C (Consumer)
↓ Access APIRole Assignment Rules
Assignment at Creation
- Creator device: Default Publisher
- Other devices: Auto Consumer
Runtime Resolution
YAT resolves roles from following sources:
- Participants list - Runtime participant information
- Sessions list - Session information
- Config configuration - tunnelRole field
// Role resolution priority
1. role in participants
2. publisherDeviceId / consumerDeviceId in sessions
3. config.tunnelRole
4. Default fallbackPermission Matrix
| Operation | Publisher | Consumer | Controller |
|---|---|---|---|
| Start Tunnel | ✅ | ❌ | ✅ |
| Stop Tunnel | ✅ | ❌ | ✅ |
| View Status | ✅ | ✅ | ✅ |
| Access Service | ✅ | ✅ | ✅ |
| Modify Configuration | ✅ | ❌ | ✅ |
| Delete Tunnel | ✅ | ❌ | ✅ |
| Manage Participants | ❌ | ❌ | ✅ |
Session Management
What is Session?
Session represents one tunnel running instance.
Session ID Format
Format: {appId}:{tunnelId}:{deviceId}:{actorRole}
Examples:
- app-ard:tunnel-123:device-abc:publisher
- app-ard:tunnel-123:device-xyz:consumerWhy Need Role Suffix?
Same device may play different roles at different times:
Device A morning: publisher (service provider role)
Device A afternoon: consumer (accessing other services role)
Session distinction:
- ard:tunnel-123:device-A:publisher
- ard:tunnel-456:device-A:consumerSession Lifecycle
Create tunnel
↓
Start channels → Create Session
↓
Running → Session active
↓
Stop channels → Session ended
↓
Delete tunnel → Session cleanedDevice Management
Device ID
Each device has a unique device ID:
Format: device-{random-string}
Example: device-a1b2c3d4e5f6View Device Information
In tunnel details' Participants section, you can see:
- Device ID
- Role
- Status (Online/Offline)
- Last Online Time
📸 [Screenshot Location] Participants List
Description: Shows device ID, role labels, status indicators
Device Status
| Status | Description |
|---|---|
| Online | Device online, participating in tunnel |
| Offline | Device offline |
| Idle | Device online but not participating |
Manage Devices
Remove Device (In Development)
Future version support:
- Enter tunnel details
- Find participants list
- Click Remove button
- Confirm remove
⚠️ Note: Removing Publisher device will cause tunnel to stop
FAQ
Q: How to switch roles?
Currently does not support runtime role switching.
Solution:
- Stop tunnel
- Delete tunnel
- Recreate on new device
Q: Can one device have multiple roles?
Yes. Same device can play different roles in different tunnels:
Tunnel A: Publisher
Tunnel B: ConsumerBut in same tunnel, one device can only have one role.
Q: What happens when Publisher goes offline?
Tunnel will stop. Because Publisher is service provider, service unavailable when offline.
Q: Can Consumer become Publisher?
Currently does not support dynamic conversion.
Design reason:
- Publisher needs to provide local service
- Consumer only accesses service
- Role conversion requires service migration
Q: How to view current device ID?
In developer tools console:
localStorage.getItem('device:id')Q: Can device ID be modified?
Not recommended. Device ID is used for:
- Identity identification
- Session management
- Permission control
Modification may cause:
- Confused tunnel state
- Permission loss
- Session failure
Q: Will multi-device simultaneous operations conflict?
YAT uses revision-based conflict resolution mechanism:
- Increment revision on each modification
- Sync latest state on conflict
- 409 conflict → sync → retry
💡 Best Practices
1. Clear Role Division
- Publisher: Stable server device
- Consumer: Mobile client device
2. Reasonable Sharing Mode Settings
Personal multi-device: Shared
Team collaboration: Shared
Sensitive service: Exclusive3. Monitor Device Status
Regularly check participants list:
- Is Publisher online
- Is Consumer count reasonable
- Any abnormal devices
4. Device Naming Convention
Recommend labeling on devices:
MacBook-Pro (Publisher)
ThinkPad (Consumer)
iPhone (Consumer)📚 Related Documentation
- Tunnel Management - Create shared tunnels
- Apps and Extensions - ARD multi-device usage
- FAQ - Role-related issues
YAT Team - Making intranet penetration simpler