Skip to content

EventFabric/nodejs-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Event Fabric API Client

Nodejs implementation of Event Fabric API to send events.

Setup

If you want to use the library you can install it with npm:

npm install

Usage

see the examples folder for more usage examples

var ef = require('./eventfabric');
var client = ef.client("your_username", "your_password");

function onLoginSuccess (data) {
    var value = {
        "text": "cpu",
        "percentage": Math.random() * 100
    };

    function onEventSent(status, data) {
        var eventSent = JSON.parse(data);
        console.log("event sent", status, eventSent);
    }

    function onEventFail (status, res) {
        console.error("event error", status, res);
    }

    client.sendEvent({
        value: value,
        channel: "your_channel"
    }, onEventSent, onEventFail);
}

function onLoginFail(err) {
    console.error("login error", err);
}

client.login(onLoginSuccess, onLoginFail);

Test

nodejs test.js

License

MIT

About

Nodejs implementation of Event Fabric API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published