The SimDeck Inspector protocol is a lightweight JSON-based protocol used by in-app inspectors to publish UI trees and handle debug actions. It is primarily intended for developers building or debugging an inspector runtime.
Transport Mechanisms
Depending on the runtime, the protocol is delivered via different transports:
| Transport | Used by |
|---|
TCP on 127.0.0.1:47370-47402 | Swift in-app agent |
WebSocket /api/inspector/connect | NativeScript, React Native, Flutter, and other outbound runtimes |
Polling /api/inspector/poll plus /api/inspector/response | Fallback when WebSocket is unavailable |
Protocol Envelope
All messages follow a specific JSON structure for Requests, Success responses, Errors, and Events.
Note: If the inspector was started with an auth token, all requests must include a matching top-level token field.
// Request Example
{
"id": 1,
"method": "View.getHierarchy",
"params": { "maxDepth": 4 }
}
// Success Response Example
{
"id": 1,
"result": { "roots": [] }
}
// Error Response Example
{
"id": 1,
"error": {
"code": -32004,
"message": "No view was found for id view:0x1234."
}
}
// Event Example
{
"event": "Inspector.connected",
"params": { "protocolVersion": "0.1" }
}