Teyk0o/WSListener

A minimal Firefox extension that intercepts every WebSocket frame on the current page and lets you inspect and export them.

★ 1Forks 0JavaScriptGitHub ↗Compare

README

WS Listener

A minimal Firefox extension that intercepts every WebSocket frame on the current page and lets you inspect and export them.

WS Listener screenshot

Features

  • Captures sent and received frames in real time, including binary (Blob / ArrayBuffer) messages
  • Tracks connection lifecycle events (open, close, error)
  • Filters by direction (sent / received / open-close) and free-text search
  • Detail panel with automatic JSON pretty-print
  • One-click export as JSON or CSV

How it works

injected.js          patches window.WebSocket inside the page context
     ↓  CustomEvent
content_script.js    bridges the page ↔ extension boundary
     ↓  runtime.sendMessage
background.js        stores frames per tab, notifies the popup
     ↓  runtime.sendMessage
popup.js             renders the UI and handles exports

The key constraint is that a content script runs in an isolated sandbox and cannot patch window.WebSocket directly. injected.js is loaded as a regular <script> tag so it executes in the page's own JavaScript context.

Installation (temporary, for development)

  1. Open Firefox and navigate to about:debugging
  2. Click This Firefox → Load Temporary Add-on…
  3. Select the manifest.json file from this folder

The extension stays active until Firefox is restarted. For a permanent install, sign the extension via addons.mozilla.org.

Files

File Role
manifest.json Extension manifest (Manifest V2)
injected.js WebSocket proxy injected into the page context
content_script.js Injects the script and relays events to the background
background.js Stores frames per tab and pushes updates to the popup
popup.html Popup markup and styles
popup.js Popup logic (rendering, filtering, export)

License

MIT © 2026 Teyko — see LICENSE.

Limitations

  • Firefox only (uses browser.* APIs and Manifest V2 browser_action)
  • Frames sent before the content script runs (very early document_start code) may be missed on extremely fast connections
  • Binary frames are decoded as UTF-8 text via Blob.text()

Issues