@p4d/hermes-nodejs

    1.4.0 • Public • Published

    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

    Keywords

    Install

    npm i @p4d/hermes-nodejs

    DownloadsWeekly Downloads

    11

    Version

    1.4.0

    License

    WTFPL

    Last publish

    Collaborators

    • javougarte
    • shipupi
    • tmigone
    • p4d-owner