Can not connect to node.js inspector using WebSocket
I am trying to develop a node.js debugger in JavaScript. I am executing a JS script using node --inspect-brk
like below-
c:nodenode --inspect-brk test.js
Then it prints the WebSocket URL-
Debugger listening on ws://127.0.0.1:9229/bb6eed9d-19d4-47ae-99cf-2f2a09e125ef
For help see https://nodejs.org/en/docs/inspector
Now I am using WebSocket to connect-
var ws = new WebSocket("ws://127.0.0.1:9229/bb6eed9d-19d4-47ae-99cf-2f2a09e125ef");
ws.onmessage = function(data){console.log(data);}
ws.onerror = function(data){console.log(data);}
But, when I send the continue
command then I get no response from V8-
ws.send(JSON.stringify({"seq":117,"type":"request","command":"continue"}));
I found the command for V8 protocol here - https://github.com/buggerjs/bugger-v8-client/blob/master/PROTOCOL.md
In fact ws.readyState
is 1, that means connection got established properly. There is no error or message logged. Even in chrome network tab I can see data sent but there is no data received from V8, see screenshot.
Test JS code-
var x=1;
x++;
console.log(x);
node.js v8 node-inspector
add a comment |
I am trying to develop a node.js debugger in JavaScript. I am executing a JS script using node --inspect-brk
like below-
c:nodenode --inspect-brk test.js
Then it prints the WebSocket URL-
Debugger listening on ws://127.0.0.1:9229/bb6eed9d-19d4-47ae-99cf-2f2a09e125ef
For help see https://nodejs.org/en/docs/inspector
Now I am using WebSocket to connect-
var ws = new WebSocket("ws://127.0.0.1:9229/bb6eed9d-19d4-47ae-99cf-2f2a09e125ef");
ws.onmessage = function(data){console.log(data);}
ws.onerror = function(data){console.log(data);}
But, when I send the continue
command then I get no response from V8-
ws.send(JSON.stringify({"seq":117,"type":"request","command":"continue"}));
I found the command for V8 protocol here - https://github.com/buggerjs/bugger-v8-client/blob/master/PROTOCOL.md
In fact ws.readyState
is 1, that means connection got established properly. There is no error or message logged. Even in chrome network tab I can see data sent but there is no data received from V8, see screenshot.
Test JS code-
var x=1;
x++;
console.log(x);
node.js v8 node-inspector
add a comment |
I am trying to develop a node.js debugger in JavaScript. I am executing a JS script using node --inspect-brk
like below-
c:nodenode --inspect-brk test.js
Then it prints the WebSocket URL-
Debugger listening on ws://127.0.0.1:9229/bb6eed9d-19d4-47ae-99cf-2f2a09e125ef
For help see https://nodejs.org/en/docs/inspector
Now I am using WebSocket to connect-
var ws = new WebSocket("ws://127.0.0.1:9229/bb6eed9d-19d4-47ae-99cf-2f2a09e125ef");
ws.onmessage = function(data){console.log(data);}
ws.onerror = function(data){console.log(data);}
But, when I send the continue
command then I get no response from V8-
ws.send(JSON.stringify({"seq":117,"type":"request","command":"continue"}));
I found the command for V8 protocol here - https://github.com/buggerjs/bugger-v8-client/blob/master/PROTOCOL.md
In fact ws.readyState
is 1, that means connection got established properly. There is no error or message logged. Even in chrome network tab I can see data sent but there is no data received from V8, see screenshot.
Test JS code-
var x=1;
x++;
console.log(x);
node.js v8 node-inspector
I am trying to develop a node.js debugger in JavaScript. I am executing a JS script using node --inspect-brk
like below-
c:nodenode --inspect-brk test.js
Then it prints the WebSocket URL-
Debugger listening on ws://127.0.0.1:9229/bb6eed9d-19d4-47ae-99cf-2f2a09e125ef
For help see https://nodejs.org/en/docs/inspector
Now I am using WebSocket to connect-
var ws = new WebSocket("ws://127.0.0.1:9229/bb6eed9d-19d4-47ae-99cf-2f2a09e125ef");
ws.onmessage = function(data){console.log(data);}
ws.onerror = function(data){console.log(data);}
But, when I send the continue
command then I get no response from V8-
ws.send(JSON.stringify({"seq":117,"type":"request","command":"continue"}));
I found the command for V8 protocol here - https://github.com/buggerjs/bugger-v8-client/blob/master/PROTOCOL.md
In fact ws.readyState
is 1, that means connection got established properly. There is no error or message logged. Even in chrome network tab I can see data sent but there is no data received from V8, see screenshot.
Test JS code-
var x=1;
x++;
console.log(x);
node.js v8 node-inspector
node.js v8 node-inspector
edited May 15 '18 at 11:19
saurav
asked May 10 '18 at 11:51
sauravsaurav
537618
537618
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
try to send this message: {"id": 7, "method": "Runtime.runIfWaitingForDebugger"}
;
i think that maybe the problem is the parameter "-brk" blocks the nodejs process. so when you send message, it can not get response. but when you open chrome to debug it at that time, you found it works well. so, open the chrome devtool and check the ws network info. i found ws sends some messages when it builds. maybe when you send message: "Runtime.runIfWaitingForDebugger", the nodejs process will continue running.
shell.js
ws network
3
Could you elaborate a bit on the solution you are providing? Why would that work?
– Urosh T.
Nov 23 '18 at 7:41
Really helpful answer. Thanks a lot.
– saurav
Nov 24 '18 at 16:05
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50272317%2fcan-not-connect-to-node-js-inspector-using-websocket%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
try to send this message: {"id": 7, "method": "Runtime.runIfWaitingForDebugger"}
;
i think that maybe the problem is the parameter "-brk" blocks the nodejs process. so when you send message, it can not get response. but when you open chrome to debug it at that time, you found it works well. so, open the chrome devtool and check the ws network info. i found ws sends some messages when it builds. maybe when you send message: "Runtime.runIfWaitingForDebugger", the nodejs process will continue running.
shell.js
ws network
3
Could you elaborate a bit on the solution you are providing? Why would that work?
– Urosh T.
Nov 23 '18 at 7:41
Really helpful answer. Thanks a lot.
– saurav
Nov 24 '18 at 16:05
add a comment |
try to send this message: {"id": 7, "method": "Runtime.runIfWaitingForDebugger"}
;
i think that maybe the problem is the parameter "-brk" blocks the nodejs process. so when you send message, it can not get response. but when you open chrome to debug it at that time, you found it works well. so, open the chrome devtool and check the ws network info. i found ws sends some messages when it builds. maybe when you send message: "Runtime.runIfWaitingForDebugger", the nodejs process will continue running.
shell.js
ws network
3
Could you elaborate a bit on the solution you are providing? Why would that work?
– Urosh T.
Nov 23 '18 at 7:41
Really helpful answer. Thanks a lot.
– saurav
Nov 24 '18 at 16:05
add a comment |
try to send this message: {"id": 7, "method": "Runtime.runIfWaitingForDebugger"}
;
i think that maybe the problem is the parameter "-brk" blocks the nodejs process. so when you send message, it can not get response. but when you open chrome to debug it at that time, you found it works well. so, open the chrome devtool and check the ws network info. i found ws sends some messages when it builds. maybe when you send message: "Runtime.runIfWaitingForDebugger", the nodejs process will continue running.
shell.js
ws network
try to send this message: {"id": 7, "method": "Runtime.runIfWaitingForDebugger"}
;
i think that maybe the problem is the parameter "-brk" blocks the nodejs process. so when you send message, it can not get response. but when you open chrome to debug it at that time, you found it works well. so, open the chrome devtool and check the ws network info. i found ws sends some messages when it builds. maybe when you send message: "Runtime.runIfWaitingForDebugger", the nodejs process will continue running.
shell.js
ws network
edited Nov 23 '18 at 11:02
answered Nov 23 '18 at 7:37
rainrain
262
262
3
Could you elaborate a bit on the solution you are providing? Why would that work?
– Urosh T.
Nov 23 '18 at 7:41
Really helpful answer. Thanks a lot.
– saurav
Nov 24 '18 at 16:05
add a comment |
3
Could you elaborate a bit on the solution you are providing? Why would that work?
– Urosh T.
Nov 23 '18 at 7:41
Really helpful answer. Thanks a lot.
– saurav
Nov 24 '18 at 16:05
3
3
Could you elaborate a bit on the solution you are providing? Why would that work?
– Urosh T.
Nov 23 '18 at 7:41
Could you elaborate a bit on the solution you are providing? Why would that work?
– Urosh T.
Nov 23 '18 at 7:41
Really helpful answer. Thanks a lot.
– saurav
Nov 24 '18 at 16:05
Really helpful answer. Thanks a lot.
– saurav
Nov 24 '18 at 16:05
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f50272317%2fcan-not-connect-to-node-js-inspector-using-websocket%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown