Skip to content
This repository has been archived by the owner on Nov 11, 2018. It is now read-only.

Commit

Permalink
Merge pull request #40 from wpreul/master
Browse files Browse the repository at this point in the history
Adding example of running tv
  • Loading branch information
geek committed Mar 19, 2013
2 parents 798c013 + 6b56963 commit 7908306
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,39 @@
<a href="https://github.com/spumko"><img src="https://raw.github.com/spumko/spumko/master/images/from.png" align="right" /></a>
![tv Logo](https://raw.github.com/spumko/tv/master/images/tv.png)

Interactive debug console for [**hapi**](https://github.com/spumko/hapi)
Interactive debug console plugin for [**hapi**](https://github.com/spumko/hapi)

[![Build Status](https://secure.travis-ci.org/spumko/tv.png)](http://travis-ci.org/spumko/tv)

The debug console is a simple web page in which developers can subscribe to a debug id (or * for all), and then include that
debug id as an extra query parameter with each request. The server will use WebSocket to stream the subscribed request logs to
the web page in real-time. To enable the debug console in a **hapi** application, set the server's `debug` option to true or
to an object with custom configuration as described in the **hapi** documentation.
the web page in real-time. To enable the debug console in a **hapi** application, install **tv** and require it using either the _'composer'_ configuration or with the _'plugin'_ interface. Below is an example of incuding **tv** using the _'plugin'_ interface:

```javascript
var Hapi = require('hapi');

var server = new Hapi.Server();
var options = {
webSocketPort: 3000,
debugEndpoing: '/debug/console',
queryKey: 'debug'
};

server.plugin.require('./tv', options, function (err) {

if (!err) {
server.start();
}
});
```


### Debug

To assist in debugging server events related to specific incoming requests, **hapi** includes an optional debug console which is turned _off_ by default.
The debug console is a simple web page in which developers can subscribe to a debug id, and then include that debug id as an extra query parameter in each
request. The server will use WebSocket to stream the subscribed request logs to the web page in real-time. In application using multiple server instances,
only one can enable the debug interface using the default port. To enable the debug console set the `debug` option to _true_ or to an object with custom
configuration:
request. The server will use WebSockets to stream the subscribed request logs to the web page in real-time. In applications using multiple server instances,
only one server can enable the debug interface using the default port. Below are the options available to be passed into the **tv** plugin:

- `websocketPort` - the port used by the WebSocket connection. Defaults to _3000_.
- `debugEndpoint` - the debug console request path added to the server routes. Defaults to _'/debug/console'_.
- `queryKey` - the name or the request query parameter used to mark requests being debugged. Defaults to _debug_.

0 comments on commit 7908306

Please sign in to comment.