ipp-spy
Listen for IPP requests on a given port and proxy requests to a real IPP printer. Allows for spying on the traffic between the client and the server.
Installation
npm install ipp-spy --save
Usage Example
Start an IPP printer spy on port 3000 and proxy all requests to
example.com
:
var spy = var opts = port: 3000 forwardHost: 'example.com' // defaults to localhost forwardPort: 631 // default to 631
API
The module exposes a generator function which creates a new spy proxy. An EventEmitter is returned:
var server =
Options:
port
- the port that the spy should listen onforwardHost
- the host to forward requests to (defaults tolocalhost
)forwardPort
- the port to forward requests to (defaults to631
)
The optional onOperation
callback argument will be attached to the
operation
event emitted by the returned EventEmitter.
The returned EventEmitter can emmit the following events:
Event: connection
{}
Emitted every time a new TCP connection is made to the spy proxy.
client
- a TCP socket streaming the data coming from the clientserver
- a TCP socket streaming the data returned from the server
Event: operation
{}
Emitted every time an IPP request is sent to the spy.
The callback is called with two arguments:
operation
- the IPP opperation metadata. See ipp-encoder for detailsdocument
- a readable stream containing the body of the IPP request (i.e. the document being printed)
License
MIT