Hey guys,I've been working in https://github.com/c4milo/node-webkit-agent in my spare time. The idea is to develop an agent for nodejs than can communicate with webkit inspector front-end. As many of you already know, Webkit folks announced recently the remote debugging protocol and node-webkit-agent is an attempt to implementevery domain of the protocol so that we can use webkit inspector as a development tool in nodejs as well.
How is it different from node-inspector?Well, I basically took a different approach. Danny Coates' approach was to have a patched version of webkit inspector front-end and it worked fine at the beginning but then, it just was really hard for him to keep it up to date due to the insanely fast v8 and webkit development process. So, in node-webkit-agent there is no front-end, at least for now. it just enables a websocket service for the webkit built-in frontend to connect with it. It means that basically you can connect to the agent with an URL like this:You can start also a Chrome browser using the --remote-debugging-port that will serve the front-end for you and just change the parameter **ws** in the URL to the host and port where your node-webkit-agent is listening.
So far CPU and heap profiling are working fine, node-webkit-agent is using right now a patched version of Danny's v8-profiler. I was trying to communicate with him but it never came back so I haven't send him pull requests yet.
Anyways, this is pretty much a work in progress, pull requests and feedback are pretty much appreciated.
Best,--Camilo Aguilar
On Wednesday, May 2, 2012 10:22:08 PM UTC+4, Camilo Aguilar wrote:Hey guys,I've been working in https://github.com/c4milo/node-webkit-agent in my spare time. The idea is to develop an agent for nodejs than can communicate with webkit inspector front-end. As many of you already know, Webkit folks announced recently the remote debugging protocol and node-webkit-agent is an attempt to implementevery domain of the protocol so that we can use webkit inspector as a development tool in nodejs as well.Heh. We are the WebKit folks you are referring to.
How is it different from node-inspector?Well, I basically took a different approach. Danny Coates' approach was to have a patched version of webkit inspector front-end and it worked fine at the beginning but then, it just was really hard for him to keep it up to date due to the insanely fast v8 and webkit development process. So, in node-webkit-agent there is no front-end, at least for now. it just enables a websocket service for the webkit built-in frontend to connect with it. It means that basically you can connect to the agent with an URL like this:You can start also a Chrome browser using the --remote-debugging-port that will serve the front-end for you and just change the parameter **ws** in the URL to the host and port where your node-webkit-agent is listening.I like your approach, but it has one problem associated with it. When we commit to the protocol backwards compatibility, we only commit to backwards compatible backend and only on the set of the public (non-hidden) methods. So "newer" front-end is not guaranteed to work with the old backend. [While adding new features to the WebInspector front-end we often use "hidden" protocol methods and rely upon their existence on the ToT backend]. Our long term goal though is to make all the methods public and allow newer versions of the front-end to be able to attach to the older backends. It is just that it is not the priority for us right now.
So far CPU and heap profiling are working fine, node-webkit-agent is using right now a patched version of Danny's v8-profiler. I was trying to communicate with him but it never came back so I haven't send him pull requests yet.I think Debugger domain is the one that helps the most, so am looking forward to its implementation.
Anyways, this is pretty much a work in progress, pull requests and feedback are pretty much appreciated.An alternative path for achieving the same goal would be to extract a part of the Web Inspector backend (native code) from WebKit and compile it against node.js and its v8 natively. Inspector backend (at least its debugger and profiler domains) do not depend on WebKit much, they depend on the layer that abstracts us from V8 / JSC. You could bundle the part that is based on V8 with a handful of inspector classes, hack them a bit and make a part of node. You would then be able to take the front-end from the same WebKit revision and hence guarantee the compatibility. That would require a number of small refactorings in these native classes, but we'll accept them back in WebKit, so you won't need to fork much. As a free bonus, you'll be getting the backend support for the new debugging features automatically. But that is clearly more work with less tangible result at first.