Debug Connection Setup

The WhatzBug SDK connects to the Desktop App over WebSocket for real-time debugging.

How It Works

Mobile App (SDK) ──WebSocket:9333──> Desktop App (Electron)

The SDK streams console logs, network requests, performance metrics, crashes, and session replay frames to the Desktop App in real time.

Recommended: debug: true

The simplest way to enable debugging is to pass debug: true in your init() call:

await WhatzBug.init({
  projectId: 'your-project-id',
  publishableKey: 'pk_your_key',
  apiBaseUrl: 'https://api.whatzbug.com',
  debug: true, // auto-connects to Desktop on port 9333
});

This auto-discovers the Desktop App host and connects automatically. No separate call needed.

Custom Host / Port

To specify a custom host (e.g., for Wi-Fi device debugging):

await WhatzBug.init({
  projectId: 'your-project-id',
  publishableKey: 'pk_your_key',
  apiBaseUrl: 'https://api.whatzbug.com',
  debug: { host: '192.168.1.100', port: 9333 },
});

Connection Scenarios

Android Emulator

No configuration needed. The SDK auto-resolves the host to 10.0.2.2.

Physical Device via USB

adb reverse tcp:9333 tcp:9333

Physical Device via Wi-Fi

Use the debug: { host: ... } option shown above with your machine’s IP address.

iOS Simulator

No configuration needed — connects to localhost:9333 automatically.

Production Safety

Tip

Only enable debug mode in development builds. In production, omit debug or set it to false.

Legacy: enableDebug()

The previous enableDebug() method still works but is deprecated. Use debug: true in init() instead.

// Deprecated — use debug: true in init() instead
WhatzBug.enableDebug({
  appName: 'My App',
  port: 9333,
});

Related