Zsynuting / remote-debug-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This project is for demonstration purposes only.

use the following steps to run this project

  • npm install: to install dependencies for web-ide project and web-server project using pnpm, if pnpm is not installed globally, please install it first or change corresponding scripts to use other package manager like npm or yarn
  • npm run init: this project has a zipped chrome devtools ui package at web-server/inspector.zip, this step is to unzip the package
  • npm run start: to start the web-server and web-ide

implementation

  • web-ide

    • monaco editor, using @monaco-editor/react
  • web-server

    • use node --inspect-brk to start a debugging node instance
    • use koa and koa-websocket to forwarding websocket messages between chrome devtools and debugging node instance

something found during implementing this demo

  • chrome devtools cannot connect to node instance running in debugging mode

    • maybe node doesn't allow this happening for safety concern
  • need to initialize a ws proxy between devtools frontend and node instance

  • node --inspect-brk=9222 index.js if node is already inspecting on the specified port, it will execute the script without waiting for the debugger to connect

  • when redirecting CDP message between web socket instances, the message is originally Buffer type, we need to convert it to string type before sending.

About


Languages

Language:JavaScript 44.8%Language:TypeScript 32.7%Language:HTML 17.9%Language:CSS 4.7%