[aerogear-dev] Debugging your Aerogear Application remotly with Weinre

Sebastien Blanc scm.blanc at gmail.com
Wed Jan 2 08:58:45 EST 2013


Hi,
A few weeks ago, on the IRC channel there was a question about Weinre . For
those who don't know what Weinre is (definition from Weinre's homepage) :

weinre is a debugger for web pages, like FireBug (for FireFox) and Web
Inspector (for WebKit-based browsers), except it's designed to work *
remotely*, and in particular, to *allow you debug web pages on a mobile
device such as a phone*.

So it's extremely useful and totally in the scope of Aerogear (Web/Hybrid)
 which targets mobile development .
It's easy to setup :

1. Install the Weinre server , if you have npm : sudo npm -g install weinre
2. Start the Weinre server : weinre --httPort 8081
3. Instrument your web page to act as a debug target by adding the
following :
<script src="http://a.b.c:8081/target/target-script-min.js"></script>

To make things even easier, I've created a new branch on the kitchensink
app where step 3 is not needed anymore[1]. Instead of this you can just
activate remote debugging by passing an parameter in the URL :

http://a.b.c:8080/jboss-as-kitchensink-aerogear-js/index.html?debug=d.e.f:8081

Where d.e.f is the IP of the server where Weinre is running.

Then you can access the debug page : http://localhost:8081/client

The little tweak I made give more flexibility on how you can integrate your
app with Weinre :
- No hardcoding in your script.
- You can easily change the IP of the debug server
- The client makes only make requests to the debug servers (and there are a
lot of requests :) ) if debugging is activated.

If more people find this useful maybe we could merge it for the next
release. comments welcome !

Seb

[1] http://people.apache.org/~pmuellr/weinre/docs/latest/)
[2]
https://github.com/sebastienblanc/as-quickstarts/tree/weinre/kitchensink-aerogear-js
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-dev/attachments/20130102/71be571a/attachment.html 


More information about the aerogear-dev mailing list