Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #40 from wpreul/master

Adding example of running tv
  • Loading branch information...
commit 790830683d9030eee3eae65d89bbde3d903f21d0 2 parents 798c013 + 6b56963
Wyatt Preul geek authored
Showing with 22 additions and 7 deletions.
  1. +22 −7 README.md
29 README.md
View
@@ -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_.
Please sign in to comment.
Something went wrong with that request. Please try again.