Handles all realtime connections in the snotes20-webapp. The communication with the main app is done via AMQP.
Copy config.json.example
to config.json
, adapt values as necessary, run using your favorite node deamon tool or
simply by executing node main.js
.
main.js
, contains initialization code and loading of handlersrbbit.js
, contains all directly amqp-related codehandlers
, a directory containing the handlers as individual files
For each exchange in rabbitmq one or more handlers can be defined. They are files in ./handlers/
(or any other dir, if
set in config). All handlers in the directory are loaded automatically.
A basic handler implementation:
exports.exchange = 'EXCHANGE_NAME';
exports.handle = function (msg, content) {
// msg is the full message from amqplib
// content is the decoded and parsed JSON-body of the message as javascript-object
};