@@ -26,17 +26,16 @@ A universal command-line tool for managing iOS and Android devices, simulators,
2626 </a >
2727</p >
2828
29-
3029## Features 🚀
3130
3231- ** Device Management** : List, manage, interactive with connected mobile devices
3332- ** Cross-Platform Support** : Works with iOS physical devices, iOS simulators, Android devices, and Android emulators
3433- ** Emulator/Simulator Control** : Boot and shutdown emulators and simulators programmatically
3534- ** Screenshot Capture** : Take screenshots from any connected device with format options
3635- ** Multiple Output Formats** : Save screenshots as PNG or JPEG with quality control
37- - ** Screencapture video streaming** : Stream mjpeg video directly from device
36+ - ** Screencapture video streaming** : Stream mjpeg/h264 video directly from device
3837- ** Device Control** : Reboot devices, tap screen coordinates, press hardware buttons
39- - ** App management ** : Launch app, terminate apps. Install and uninstall coming next ⏭️
38+ - ** App Management ** : Launch app, terminate apps, install and uninstall
4039
4140## Installation 📦
4241
@@ -178,6 +177,36 @@ mobilecli io text --device <device-id> 'hello world'
178177- ` VOLUME_UP ` , ` VOLUME_DOWN ` - Volume up and down
179178- ` DPAD_UP ` , ` DPAD_DOWN ` , ` DPAD_LEFT ` , ` DPAD_RIGHT ` , ` DPAD_CENTER ` - D-pad controls (Android only)
180179
180+ ## HTTP API 🔌
181+
182+ *** mobilecli*** provides an http interface for all the functionality that is available through command line. As a matter of fact, it is preferable to
183+ use mobilecli as a webserver, so it can cache and keep tunnels alive, speeding up your interactions with the mobile device or simulator/emulator.
184+
185+ ``` bash
186+ # Start the server (default port 12000)
187+ mobile server start
188+
189+ curl http://localhost:12000/rpc -XPOST -d ' {"jsonrpc":"2.0", "id": 1, "method": "devices", "params": {}}'
190+ curl http://localhost:12000/rpc -XPOST -d ' {"jsonrpc":"2.0", "id": 1, "method": "screenshot", "params": {"deviceId": "your-device-id"}}'
191+
192+ # # WebSocket Support 🔌
193+
194+ *** mobilecli*** includes a WebSocket server that allows multiple requests over a single connection using the same JSON-RPC 2.0 format as the HTTP API.
195+
196+ ` ` ` bash
197+ # Start the server (default port 12000)
198+ mobilecli server start
199+
200+ # Connect and send requests using wscat
201+ wscat -c ws://localhost:12000/ws
202+ > {" jsonrpc" :" 2.0" ," id" :1," method" :" devices" ," params" :{}}
203+ < {" jsonrpc" :" 2.0" ," id" :1," result" :[...]}
204+ > {" jsonrpc" :" 2.0" ," id" :2," method" :" screenshot" ," params" :{" deviceId" :" your-device-id" }}
205+ < {" jsonrpc" :" 2.0" ," id" :2," result" :{...}}
206+ ` ` `
207+
208+ ** Note** : ` screencapture` is not supported over WebSocket - use the HTTP ` /rpc` endpoint for video streaming.
209+
181210# # Platform-Specific Notes
182211
183212# ## iOS Real Devices
0 commit comments