inuits/nativescript-inuits-mqttlib

Name: nativescript-inuits-mqttlib

Owner: Inuits

Description: Nativescript plugin wrapper around android-inuits-mqttlib

Created: 2017-10-18 10:22:59.0

Updated: 2018-02-08 08:06:33.0

Pushed: 2018-01-12 17:09:59.0

Homepage: null

Size: 91

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Nativescript MQTT lib wrapper around intent-controlled MQTT PAHO ECLISPSE ANDROID SERVICE

This repository is simple plugin for nativescript, that exposes External Native-Android (java) code.

This repository was created because nativescript-mqtt is using customized Paho JS MQTT library, which does not work in some cases like using SSL or configuring proper HTTP Headers for protocol switch.

The callbacks are made by catching incomming Message intents.

Interface

There is simple interface with few methods that allows most of the work done in simple way. See index.js

connect(uri, clientId)

This will connect to specified URI with custom clientId. Is clientId is not specified, underlying library will generate random UUID as client id.

disconnect()

This will disconnect from current connection

subscribe(topic, callback)

This will subscribe to the specified topic and call the callback when message arrives. The callbacks are handled inside this JS class. This is not shared among multiple instances.

unsubscribe(topic)

This will unsubscribe from specified topic

publish(topic, message)

This will publish message to specified topic


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.