How netristv/ws-scrcpy works
Project type and purpose
• This is a full‑stack single‑page web application (“ws‑scrcpy”) whose purpose is to remotely mirror and control Android (scrcpy) and experimental iOS devices in the browser.
• The README confirms it serves static UI assets over HTTP, exposes a WebSocket API, proxies to device‐side scrcpy/WebDriverAgent, and decodes H.264 frames in the browser via multiple pluggable decoders.
File structure
• Top level:
• config examples, lint & build files, docs/
• package.json, tsconfig.json, webpack/
• src/ layers:
• src/app/ → frontend application code (UI components, event handlers, video players, device‐specific clients & toolboxes)
• src/common/ → shared constants, message/channel definitions, typed event emitter
• src/packages/multiplexer/ → multiplexing logic for WS channels
• src/public/ → static assets (index.html, images)
• src/style/ → CSS styles
• src/server/ → backend code (HTTP/WebSocket servers, middleware, services for appl‑device & goog‑device, multiplexer)
• src/types/ → TypeScript definitions for messages, params, device descriptors
• webpack/ holds build configurations with override mechanism for feature flags.
README for additional insights
• Confirms HTTP server for UI, WebSocket server with multiple “channels” (video, control messages, file listing, shell, devtools) using a multiplexer.
• Lists supported frontend decoders (MSE, Broadway, TinyH264, WebCodecs).
• Describes device backends: scrcpy over WS for Android, optional MJPEG server, WebDriverAgent for iOS, file push, remote shell.