Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@p4d/hermes-js

Package Overview
Dependencies
Maintainers
3
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@p4d/hermes-js

Hermes client library for JS (browser & NodeJs)

  • 1.4.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Hermes JS Library

Description

Hermes library performs the following tasks:

  • Queue service
  • Event messaging

Queue Service

This service handles the device storage, when there's a new message, it will always be saved in the storage. If storage is unavailable, it will mantain a cache queue that will get deleted on page leave.

Event Messaging

This service needs to be initialized with the hermes url, and then will send events that are in the queue whenever the connection is available

Installation

Simply require the javascript file into your project!


<script type="text/javascript" src="js/hermes-js.js"></script>

Usage

The first step is to create the Hermes object, with the following initial configuration:

  • (string) Url: Hermes URL (should be http://hermes.p4d.com.ar:8080)
  • (json) Project: A project object is composed of the project ID (e.g: 'nike_run_analysis') and the project readable name (e.g: 'Nike Run Analysis NBA')
  • (string) Type: The type of events that will be sent, will probably be either appData or deviceStatus type

Configuration example

// Este es el use case tipico
	var hermes = new Hermes({
		url: 'http://hermes.p4d.com.ar:8080',
		project: {
			"id": 'nike_run_analysis',
			"name": 'Nike Run Analysis'
		},
		type: 'appData'
	})

After setting up the object, all that remains is to send messages, and there is a simple way to do so:

Send(data)

The send event will send the data to hermes, if internet is not connected, it will be saved in the cache to be sent when internet is available.

Data sent can be anything! But Hermes expects it to be a JSON object. A warning will be sent if it isn't.

Full example

<script type="text/javascript" src="hermes-js.js"></script>

<script type="text/javascript">

	var config = {
		url: 'http://hermes.p4d.com.ar:8080',
		project: {
			"id": 'nike_run_analysis',
			"name": 'Nike Run Analysis'
		},
		type: 'appData'
	}
	var hermes = new Hermes(config)

	var event = {
		name: 'new_experience',
		experience_id: 2
	}
	hermes.send(event)
	
</script>

TO-DO

  • Code needs some refactoring, as of now, all work lies within the Hermes Class, and probably needs to shift some responsabilities to the HermesEvent class

Keywords

FAQs

Package last updated on 24 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc