Xerlock reaches your app in two ways. Through Metro, it finds your app on its own, with nothing added
to your app. Through the SDK, init connects your app to the desktop app on port 9340. The
Connection panel shows both.
Using the Connection panel
Section titled “Using the Connection panel”Reading the connection
Section titled “Reading the connection”| Row | Shows |
|---|---|
| Status | Whether Xerlock is connected to your app through Metro |
| Device | The device or simulator the app runs on. For an Android emulator, its emulator name |
| App | The app’s bundle identifier |
| Metro | Listening for apps on port … until an app is found, then Connected to port … |
| SDK bridge | Listening on port 9340, and how many apps are connected through the SDK |
| SDK | The SDK version and a badge for each plugin your app enabled, or No plugins enabled |
Status reads:
| Status | Meaning |
|---|---|
| Waiting for a React Native app… | Metro is running, but no app is connected to it |
| Connecting… | Xerlock found your app and is connecting to it |
| Connected — … | Connected, with the device name |
| No Metro found on port … | Nothing answered on the Metro port. See Metro port |
| Could not reach … | Xerlock found your app but couldn’t connect to it, with the error |
When the connection closes, Status shows why, such as The device disconnected from Metro.
Each panel’s toolbar has a coloured dot with the same status. Hover it to read the status, or click it to open the Connection panel.
Reconnecting
Section titled “Reconnecting”Xerlock reconnects by itself when the app disconnects, reloads or Metro restarts. When the connection is lost, Reconnect appears in the Status row and next to the toolbar dot; click it to try straight away.
Only one debugger can connect to an app through Metro. If another one, such as React Native DevTools, connects, Xerlock is disconnected and doesn’t reconnect by itself. Close the other debugger and click Reconnect.
Reloading the app
Section titled “Reloading the app”Reload app reloads your app’s JavaScript, like pressing r in Metro. It’s available while an app
is connected.
Panels follow your config
Section titled “Panels follow your config”The sidebar shows the panels your app can use:
- Connection, Native logs, Debugger, React, Database and Notifications are always shown.
- Console and Network are shown unless your app is connected through the SDK and turned them
off with
console: falseornetwork: false. - TanStack Query, Zustand, Redux, Storage and Commands appear once your app enables them.
While your app reloads, its panels stay in the sidebar for a few seconds so they don’t flicker.
Metro port
Section titled “Metro port”Xerlock looks for Metro on localhost, on port 8081 unless your app reports another one. Change
it in Settings > Connection.
SDK port
Section titled “SDK port”The SDK always connects on port 9340, on localhost. This port can’t be changed.
How the SDK connects
Section titled “How the SDK connects”- On Android, the SDK also tries
10.0.2.2, the emulator’s address for your computer, whenlocalhostdoesn’t answer. - If the desktop app isn’t running, the SDK keeps trying in the background, waiting 1s between attempts at first and up to 5s later. Start the desktop app at any time and your app connects.
- Messages sent while disconnected are queued and sent once the app reconnects. The queue keeps the latest 500 messages and drops any older than 10 seconds, so a reconnect doesn’t replay stale state.
Limits and Troubleshooting
Section titled “Limits and Troubleshooting”- Xerlock connects to one app through Metro at a time, and has no way to pick between them. With several apps running, it reconnects to the last app it was connected to, otherwise the first one Metro lists.
- On Android, Xerlock forwards port
9340to every emulator and device listed byadb devices, so the SDK reaches the desktop app over USB too. This needsadbfrom the Android SDK, found throughANDROID_HOME,ANDROID_SDK_ROOT,~/Library/Android/sdkor yourPATH. - On a physical iPhone, the panels that work through Metro still work, but the SDK can’t reach the desktop app, so the panels that need the SDK don’t appear. Use the iOS Simulator for those.
- SDK says Version mismatch: the SDK in your app and the desktop app don’t match. A message says which to update: The Xerlock SDK in your app is out of date. Update @xerlock/client. or Your app uses a newer Xerlock SDK. Update Xerlock.
- SDK bridge says Unavailable: …: another program is using port
9340, such as another copy of Xerlock. Quit it and restart Xerlock. - Status is connected but SDK says Not connected: check that
initruns when your app starts, in a development build. See How the SDK connects.