gitwtfhub

wtf is pocket-browser?

shitsuten/pocket-browser — explained in plain English

Analysis updated 2026-05-18

28SwiftAudience · developerComplexity · 3/5LicenseSetup · moderate

TL;DR

A tool that turns an existing WKWebView in your iOS app into a remotely controlled channel for debugging and automation.

Mindmap

mindmap
  root((pocket-browser))
    What it does
      Remote control a WebView
      Run JS take screenshots
    Tech Stack
      Swift
      Node.js server
      WebSocket
    Commands
      ping
      goto
      js
      screenshot
    Use Cases
      Debug mobile pages
      Automate logged in sites
    Security
      Token in Keychain
      HTTPS proxy required

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Remotely debug a WebView already embedded in your iOS app from a server.

REASON 2

Automate clicks, form fills, or scraping inside a logged-in mobile WebView.

REASON 3

Take screenshots or read the DOM of a page running on a real iPhone.

REASON 4

Test how a page behaves under a real Safari engine instead of a headless browser.

What's in the stack?

SwiftNode.jsWebSocketWKWebView

How it stacks up

shitsuten/pocket-browseraymandakir-gh/gh-notchayushap18/pokefolders
Stars282828
LanguageSwiftSwiftSwift
Setup difficultymoderateeasymoderate
Complexity3/52/52/5
Audiencedevelopervibe coderdesigner

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 1h+

Requires running a Node server behind HTTPS and embedding a Swift client in your own iOS app.

GPL-3.0-or-later: you can use and modify it, but any distributed derivative must also be open sourced under the same license.

Wtf does this do

pocket-browser turns a WKWebView that already exists inside your iOS app into a remote controlled debugging and automation channel. Commands are sent from a server, the phone's web view carries them out such as opening a link, running JavaScript, taking a screenshot, or reading the page's HTML, and the result is sent back the same way. Your app still owns the web view itself, the login state, data storage, and the interface. Pocket-browser only connects the controlling side to the web view already running on the phone. The problem it addresses is that debugging mobile pages, logged in pages, or pages that depend on real WebKit behavior with a headless browser like Playwright or Puppeteer often runs into two walls: the environment does not match a real device, since a data center IP, desktop user agent, and headless runtime behave differently than a real iPhone, and keeping a machine or tunnel always on is expensive and fragile. Pocket-browser's approach is to use the phone you already carry as the execution device, so you get a real device, a real Safari engine, a real mobile user agent, and your own logged in cookies, without maintaining extra infrastructure. The system has two parts: a lightweight server, about 100 lines and stateless, that a phone connects to over WebSocket and that the controller talks to over HTTP, and a Swift client you drop into your existing app that hands your WebView to the WebSocket connection. It exposes five commands: ping to check the phone is online, goto to open a URL, js to run JavaScript and return the result, html to read the current page's full HTML, and screenshot to capture the page as a base64 PNG. Getting started involves running the server, testing the connection with a fake phone script before wiring up a real device, then adding the Swift client to your app and reading the token from Keychain. Because iOS suspends a backgrounded WebView, the README suggests keeping a quiet audio session active so the app is treated as playing audio in the background. Security notes emphasize keeping the token in Keychain, running behind an HTTPS proxy, and only using this on accounts and sites you own or are authorized to control. The project is released under the GPL 3.0 or later license, and is described as a personal side project, not a full browser.

Yoink these prompts

Prompt 1
Help me wire pocket-browser's Swift client into my iOS app's existing WKWebView.
Prompt 2
Show me how to send a goto and a js command to a connected phone using curl.
Prompt 3
Explain how to keep the WebView alive in the background using an audio session on iOS.
Prompt 4
Help me set up nginx as an HTTPS proxy in front of the pocket-browser server.

Frequently asked questions

wtf is pocket-browser?

A tool that turns an existing WKWebView in your iOS app into a remotely controlled channel for debugging and automation.

What language is pocket-browser written in?

Mainly Swift. The stack also includes Swift, Node.js, WebSocket.

What license does pocket-browser use?

GPL-3.0-or-later: you can use and modify it, but any distributed derivative must also be open sourced under the same license.

How hard is pocket-browser to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is pocket-browser for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.