npm install jecho
|17||downloads in the last week|
|17||downloads in the last month|
|Version||0.2.2 last updated 9 days ago|
|Dependencies||commander, websocket, websocket-server|
jecho is a client/server remote debugging tool written for Node.js, which aims to ease the (sad) life of the mobile web developer. It can be used with almost every browser, even desktop ones, but in those cases much more powerful debug tools already exist.
jecho.log() utility is provided to be used from within the web page, so that you can send
asynchronous messages to the server. The
jecho.log() obviously resembles the console.log() tool, but it isn't powerful that much: the serialization of objects is just a
JSON.stringify(obj, undefined, 2).
You can also use the
jecho.inspect() method to deliver a small report about the dimensions of the window, the dimensions of an HTML element (i.e.
jecho.inspect(document.body);) or a specific CSS property (i.e.
- supports bidirectional communication, thanks to WebSockets. The support is provided for the legacy and current WebSocket specifications (tested on iOS 4, 5, 6 and some versions of Android)
- if for some reasons WebSockets are not supported, then you can still use the
jecho.log()thanks to XMLHttpRequest and CORS. In this case you'll not be able to send commands to the browser, but just receive the output from jecho.log
- command line handled by readline with history (saved in ~/.jecho-history)
- uses smart eval() - meaning that "var foobar = 67" will create a real, global foobar
Each output line is composed by four elements: a timestamp, the IP address of the client, an indicator and the message.
The indicator element is a symbol with the following meanings:
>>a log message has been received from the client (unattended)
<>a response to a query has been received by the client
>!an error has been captured by the client
--internal message (not from the client)
Please note the
null values are printed as
JS UNDEFINED and
I've it tested roughly in a lot of different environments, but mostly on WebKit based browser. It also works on Firefox and Opera Mini. Expect differences on how browsers handle the serialization of objects (like
If more than one client connects to the jecho server (you see the number reported in the console prompt), you'll be able to send commands only to the last one which "talked".
npm install jecho
or download everything and just run
Note for OSX brew users: npm is not installed along the installation of nodejs (a package manager won't install another package manager).
brew install npm and read the provided instructions.
Note for Ubuntu users: everything is fine, except for users of some old 11.x distribution (problems with... Python. Don't ask).
Run the jecho server with -h to read about a couple of options it accepts.
<script src="http://<jecho server ip address and port>/jecho.js"></script> <script> jecho.log("Hello from the jecho client!"); // Will show a nice report on the server console jecho.inspect(); </script>
(The MIT License)
Copyright (c) 2012 Claudio Cicali firstname.lastname@example.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
wcauchois who provided the nice wrapper for the WebSockets fallback