This repository has been archived by the owner on Nov 11, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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_. |