This server follows a dead simple plugin workflow: received events are passed directly to one or more configured plugins, which handle the processing of the event.
Setup process for Janus can be found here.
npm install
cp src/config.sample.js src/config.js
, edit to tastenode src/server.js
See the sample config for all configuration options.
Currently implemented plugins are:
- console: Write events to console.
- file: Write events to a file (currently only supports JSON format).
- Enable the plugin by adding it to the
config.enabledPlugins
array in the configuration file - Set any appropriate config options for the plugin, eg.
config.plugin.file.outputFile = '/tmp/foo';
A plugin must export a function which returns an object with one method, handleEvent
.
The function receives two arguments:
- config: The server configuration object.
- logger: The server logging instance, should you wish to use it for logging purposes.
The console plugin provides the most simple example of the implementation.
Configuration options for a plugin can technically be in any structure in the
configuration file, but by convention should go under their own
config.plugin.[name of plugin]
object.