Understand the ios_webkit_debug_proxy architecture
masterThe proxy operates as a single-threaded system using non-blocking I/O via a socket_manager that uses select. It translates between the iOS WebInspector protocol and the WebKit Remote Debugging Protocol.
Key components include:
- device_listener: Monitors iOS device connection/disconnection events.
- (port, webinspector) pairs: Each connected device is assigned a unique port mapped to its inspector (e.g., port 9222 for device X, 9223 for device Y).
- WebSocket clients: Handles active connections to debuggable pages (e.g.,
websocketAconnected to:9222/devtools/page/7). - socket_manager: Orchestrates all socket I/O and forwards data to component-specific
on_recvhandlers.