@p4d/hermes-nodejs
v1.4.0
Published
Hermes messaging library - server version
Downloads
10
Keywords
Readme
Hermes NodeJS Package
Description
Small NPM package that forwards event messages to the queue server (RPi-Queue) through a socket server on port 9999.
Installation
npm install --save @p4d/hermes-nodejs
Usage
Require package
const Hermes = require('@p4d/hermes-nodejs')
Create hermes object
// Specifying configuration
var hermes = new Hermes({
type: 'testAppData',
project: {
id: 'test_project',
name: 'Test Project'
},
kronosId: 'abc123'
})
// Using default RPi information (Requires properly configured Raspberry Pi)
var hermes = new Hermes({
type: 'testAppData'
})
To configure RPi use rpi-config.
Send events
hermes.send(data)
Where data is a JSON object.
Full example
const Hermes = require('@p4d/hermes-nodejs')
var hermes = new Hermes({
type: 'testAppData',
project: {
id: 'test_project',
name: 'Test Project'
},
kronosId: 'abc123'
})
var data = {
name: 'new_experience',
experience_id: 2
}
hermes.send(data)
Limitations
This module requires that the queue server is correctly configured. It does not send messages on it's own. For documentation on the queue server see: RPi-Queue