A standalone (Node.js) client for Ratchet.io
Generic library for reporting exceptions and other messages to Ratchet.io. Requires a Ratchet.io account.
// include and initialize the ratchet library with your access tokenvar ratchet = ;ratchet;// record a generic message and send to ratchet.ioratchet;
Install using the node package manager, npm:
$ npm install --save ratchetio
var express = ;var ratchet = ;var app = ;app;// Use the ratchet error handler to send exceptions to your ratchet.io accountapp;app;
In your main application, require and initialize using your access_token::
var ratchet = ;ratchet;
Other options can be passed into the init() function using a second parameter. E.g.:
// Queue up and report messages/exceptions to ratchet every 5 secondsratchet;
When you are finished using ratchet, clean up any remaining items in the queue using the shutdown function:
ratchet.init() takes the following configuration options (pass in the second parameter):
host: The hostname of the server the node.js process is running on
environment: The environment the code is running in.
handler: The method that the notifier will use to report exceptions.
handlerInterval: If the handler is
setInterval, this is the number of seconds between batch posts of items to ratchet.io.
batchSize: The max number of items sent to ratchet.io at a time.
endpoint: The Ratchet.io API base url.
root: The path to your code, (not including any trailing slash) which will be used to link source files on ratchet.io.
branch: The branch in your version control system for this code
scrubFields: List of field names to scrub out of POST. Values will be replaced with astrickses. If overriding, make sure to list all fields you want to scrub, not just fields you want to add to the default. Param names are converted to lowercase before comparing against the scrub list.
['passwd', 'password', 'secret', 'confirm_password', 'password_confirmation']
Contributions are welcome. The project is hosted on github at http://github.com/ratchetio/node_ratchet
See the examples directory for more uses.
If you have any questions, feedback, etc., drop us a line at email@example.com