Session Lifecycle & Method Namespace#
9. Session lifecycle#
TCP connect
│
▼
Handshake (pair or auth) → EncryptedConnection
│
▼
HELLO exchange (one frame each direction, simultaneous)
│ client.hello(my_manifest) ──► server.hello(my_manifest)
│ client ◄── server HELLO (capabilities + optional error)
│
▼ [server HELLO error → ProtocolError, connection closes]
│
▼
peer.start() ← spawns background recv loop
│
├── outbound: peer.call(method, params) → result dict
│ or peer.stream(method, params) → AsyncIterator
│
├── inbound: Dispatcher.call / Dispatcher.stream (server side)
│
├── push: peer.push(topic, payload) / peer.on_push(handler)
│
▼
peer.aclose() or connection drop
└── all in-flight calls fail with ConnectionClosed
Single-controller invariant (server side): at most one session exists at a
time. The accept_lock in OpendeskServer._handle_connection serialises the
“check-existing + register-new” step:
Same peer reconnecting → old session evicted (
session.evictedPUSH sent), new session registered.Different peer while one is active → HELLO sent with
error.code = "busy", connection closed.
10. Method namespace#
Method names are <namespace>.<verb> strings. The full set dispatched by
ComputerDispatcher:
Observation methods (auto-approved by ConsolePolicy)#
Method |
Description |
|---|---|
|
Screenshot → Pixmap |
|
List monitors |
|
Current pointer position |
|
Streaming display frames |
|
All windows |
|
Focused window |
|
Accessibility element tree |
|
Read clipboard contents |
|
Read file bytes |
|
List directory |
|
File metadata |
|
Running processes |
|
Installed / running applications |
|
Recent notifications |
|
Streaming input events |
|
Capability manifest |
|
Environment variables + platform info |
Action methods (require policy approval)#
Method |
Description |
|---|---|
|
Mouse move / click / drag / scroll |
|
Key press / release / chord |
|
Type a string |
|
Launch application |
|
Quit application |
|
Bring application to front |
|
Focus a specific window |
|
Reposition / resize a window |
|
Close a window |
|
Perform accessibility action on element |
|
Write clipboard contents |
|
Write file bytes |
|
Delete file or directory |
|
Move / rename file |
|
Create directory |
|
Run shell command |
|
Run process directly (no shell) |
|
Lock the screen |
Last section: Discovery, Admin IPC & Cryptographic Summary →