Connect Your Device

Snapbug supports two connection modes:

  • Chrome Extension room-code pairing: recommended
  • Legacy localhost / Desktop transport: only for older workflows

Chrome Extension pairing

This is the default connection flow.

What happens

  1. The Chrome Extension creates a 6-digit room code.
  2. Your app opens Snapbug and enters or scans that code.
  3. The SDK connects through the relay and upgrades to WebRTC when available.
  4. The extension starts receiving live inspector data.

Why this is preferred

  • No ADB commands
  • No port forwarding
  • No need to be on the same network
  • Better onboarding for QA, PM, and support teams

App-side requirements

  • The Snapbug SDK must already be started, for example Snapbug.start(this) on Android.
  • The device must have internet access to reach the relay host.
  • The room code must still be valid when the app submits it.

Connection state

The SDK reports these states during startup:

  • Disconnected
  • Connecting
  • Connected(viaRelay = ..., viaWebRtc = ...)
  • Error(message = ...)

If the app connects but quickly falls back to Error, the room code may have expired or been entered incorrectly.

Legacy localhost mode

Use this only if your team still depends on the Desktop app or direct local transport.

The legacy path uses:

  • WebSocket on 9023
  • HTTP uploads on 9024

On Android 9+ you may need a network security config that allows cleartext traffic to localhost and 127.0.0.1.

<application
    android:networkSecurityConfig="@xml/network_security_config" />
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">localhost</domain>
        <domain includeSubdomains="true">127.0.0.1</domain>
    </domain-config>
</network-security-config>

Troubleshooting checklist

  • Recreate the room code if the first attempt fails.
  • Verify the app really initialized Snapbug before trying to connect.
  • Confirm the device can reach the relay.
  • If you are using legacy localhost mode, verify that ports 9023 and 9024 are reachable.