Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up weinre remote debugging

Tags:

weinre

Instructions for running weinre state that I need to insert following script:

<script src="http://a.b.c:8081/target/target-script-min.js"></script>

where http://a.b.c is my server IP or host name.

Couple of questions:

Does this mean that I must open port 8081 on my remote server?

Also what is the target-script-min.js? It looks like I need to upload it to a target folder?

like image 571
dev.e.loper Avatar asked Apr 11 '13 19:04

dev.e.loper


3 Answers

The way you start the weinre sever is by running the command

weinre

in your command line. And then you leaving it running for as long as you're still using weinre. You have options for this command that you can find by type weinre --help, but the important ones are --boundHost, and --httpPort. --boundHost defaults to localhost and --httpPort defaults to 8080. So run

weinre --boundHost 192.168.1.2

where 192.168.3.4 is your ip address, which you can find by running ipconfig. Put the following in your code:

<script src="http://192.168.1.2:8080/target/target-script-min.js#whatever"></script>

Then, in your browser, go to

http://192.168.1.2:8080/client/#whatever

I wrote a blog post about it here: https://adam.garrett-harris.com/how-to-setup-remote-debugging-in-phonegap

To answer your second question, the target-script-min.js is just a javascript file that's a part of weinre whenever you install it. When you have weinre running, you can visit

http://192.168.1.2:8080/target/target-script-min.js

to see the file if you want.

like image 84
aharris88 Avatar answered Nov 10 '22 01:11

aharris88


The weinre server is "started" by executing this command weinre --boundHost a.b.c.d where a.b.c.d stands for the local IP of the desktop used for debugging. The port 8080 will be opened (default port, but you may configure an other one).

At this point, the script http://a.b.c.d:8080/target/target-script-min.js becomes available on your local network, and may be called by your application located on an other device in the same local network.

If your application or tested web page call this script, it will be seen by your desktop.

Therefore, you don't have anything to upload on your target...

like image 33
Yako Avatar answered Nov 09 '22 23:11

Yako


Weinri debug resume

After successfully installed weinri,

1 - Run this command with your ip address:

  weinre --boundHost 192.168.12.3

2 - Attach in your code header:

<script src="http://192.168.12.3:8080/target/target-script-min.js#anonymous"></script>

3 - Access your website in your tablet or whatever device

3 - Get the wenri debug screen on:

   http://localhost:8080/client/#anonymous

Obs: 'anonymous' word can be replaced by another of your choice.

like image 33
Fillype Farias Avatar answered Nov 09 '22 23:11

Fillype Farias