{"id":15724328,"url":"https://github.com/cedlemo/node-inspect-protocol","last_synced_at":"2026-05-03T07:45:56.512Z","repository":{"id":144939697,"uuid":"179863575","full_name":"cedlemo/node-inspect-protocol","owner":"cedlemo","description":"Exploring the protocol used to interact with node inspect","archived":false,"fork":false,"pushed_at":"2019-04-13T17:55:52.000Z","size":27,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-03T15:22:33.005Z","etag":null,"topics":["javascript","nodejs"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cedlemo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-06T17:15:56.000Z","updated_at":"2021-01-25T07:20:08.000Z","dependencies_parsed_at":"2023-04-04T21:03:15.170Z","dependency_job_id":null,"html_url":"https://github.com/cedlemo/node-inspect-protocol","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cedlemo/node-inspect-protocol","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedlemo%2Fnode-inspect-protocol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedlemo%2Fnode-inspect-protocol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedlemo%2Fnode-inspect-protocol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedlemo%2Fnode-inspect-protocol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cedlemo","download_url":"https://codeload.github.com/cedlemo/node-inspect-protocol/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cedlemo%2Fnode-inspect-protocol/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32562118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","nodejs"],"created_at":"2024-10-03T22:16:12.661Z","updated_at":"2026-05-03T07:45:56.497Z","avatar_url":"https://github.com/cedlemo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Node inspect and exploring the debugging protocol\n\n## Overview\n\nWhen launching a JavaScript application with `node --inspect`, there is a websocket\nserver that wait for a debugger. The debugger can connect using an url that looks like this\none:\n```\nws://127.0.0.1:9229/14936faf-0fc8-4d49-ba43-f9d8187382a3\n```\n\nAfter the connection is initiated, the client debugger can send command to the\nserver debugger in the json format.\n\nBecause of the asynchronous way of working of node, every messages send by the\nclient must provide an id. The server will send a result with the same id send\nin the request.\n\nThe protocol used is discribed here:\n* https://chromedevtools.github.io/devtools-protocol/v8/Debugger/\n\n## Description of the protocol\n\n### Start a debug session\nThe websocket connection is initialized. The first thing to do is to enable the\ndebugger. For this the data to send is:\n\n```javascript\n  let cmd = {'id':1, 'method':'Debugger.enable'}\n  ws.send(JSON.stringify(cmd))\n```\n\nThis command force node to load the script and its dependencies. When they are\nparsed, it triggers the [Debugger.scriptParsed](https://chromedevtools.github.io/devtools-protocol/v8/Debugger#event-scriptParsed) event for each of them and return to the client debugger a lot of information about\nthose scripts.\n\nThe data returned is of the following form:\n\n```json\n{\n  \"method\":\"Debugger.scriptParsed\",\n  \"params\":{\n    \"scriptId\":\"183\",\n    \"url\":\"internal/dgram.js\",\n    \"startLine\":0,\"startColumn\":0,\n    \"endLine\":85,\"endColumn\":0,\n    \"executionContextId\":1,\n    \"hash\":\"25db743041b0488827a8a03aa0ff67fb7ac77c17\",\n    \"executionContextAuxData\":{\"isDefault\":true},\n    \"isLiveEdit\":false,\n    \"sourceMapURL\":\"\",\n    \"hasSourceURL\":false,\n    \"isModule\":false,\n    \"length\":1833\n  }\n}\n```\nWhen all the data related to the parsed script are sent, the server return a\nresponse with the same id as the initial request and a `debuggerId`.\n\n```json\n{\"id\":1,\"result\":{\"debuggerId\":\"(D750AD89818A150E3155AC1D6ECB7BB)\"}}\n```\n\n### Managing break points\n\n* list availables break points\n* add/remove a break point\n* run/rerun the current context\n* explore stack trace\n\n## Idea\n* write a nvim plugin to debugg Node application\n\n## Sources\n* https://chromedevtools.github.io/devtools-protocol/v8/Debugger/\n* https://nodejs.org/api/vm.html\n* https://stackoverflow.com/questions/50272317/can-not-connect-to-node-js-inspector-using-websocket\n* https://nodejs.org/en/docs/guides/debugging-getting-started/\n* https://github.com/nodejs/node-inspect/blob/master/lib/internal/inspect_client.js\n* https://medium.freecodecamp.org/supercharge-your-debugging-experience-for-node-js-3f0ddfaffbb2\n* https://chromedevtools.github.io/devtools-protocol/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedlemo%2Fnode-inspect-protocol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcedlemo%2Fnode-inspect-protocol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcedlemo%2Fnode-inspect-protocol/lists"}