Skip to content
This repository has been archived by the owner on Jan 17, 2019. It is now read-only.

Bambil/Haho

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Haho

GitHub stars npm version npm license npm

Haho mqtt plugin for hapi.js.

Paho Mqtt moves into Hapi then they call it Haho. 😜

Usage

const Hapi = require('hapi');


const server = new Hapi.Server();

server.connection({
    port: '9090'
});

server.register({
    register: require('Haho'),
    options: {
        url: 'mqtt://localhost:1883'
    }
}, (err) => {

    if (err) {
        console.log('Failed loading plugin');
    }
    
    const haho = server.plugins.haho;
    haho.subscribe('test/hello', (topic, message) => {

        console.log('message', message);
    });
    
    /* start the server after plugin registration */
    server.start((err) => {

        if (err) {
            console.log('error when starting server', err);
        }
        console.log('service started');
    });
});

Releases

No releases published

Packages

No packages published