An open API service indexing awesome lists of open source software.

https://github.com/mqttjs/mqtt-elements

Polymer elements for MQTT
https://github.com/mqttjs/mqtt-elements

Last synced: 6 months ago
JSON representation

Polymer elements for MQTT

Awesome Lists containing this project

README

          

![mqtt-elements](https://raw.githubusercontent.com/mqttjs/mqtt-elements/67266290fe6a0b6b3ff51418efb7c1c0662c78c5/assets/mqtt-elements.png)
=======

Polymer elements to establish a MQTT connection to a MQTT broker.

## API

[API documentation](http://mqttjs.github.io/mqtt-elements/bower_components/mqtt-elements/)

## Install

```
bower install --save mqtt-elements
```

## Import

```

```

## Usage

```




```

### Connect

```

```

The method `#connect` has to be called manually to establish the MQTT connection to the MQTT broker.
Set `#auto` flag to make the MQTT connection as soon as possible.

### Connect with Username / Password

```


```

OR

```


```

The flag `#withCredentials` indecates the MQTT connection to wait until a username and password for
the connection is supplied.

### Publish

The following example will publish on the topic »mqtt/elements« with the payload »Publishing via a HTML element«.
Every time when `#payload` changes the element will publish a new MQTT message to the topic »mqtt/elements«.
If the `#auto` flag is not set - `#publish` has to be called to publish a MQTT message to the topic

```

```

#### Publish on multiple topic

A `` element can hold any number of `` elements to publish to different topics.

```



```

#### Publish a retained message

To publish a message with the RETAINED flag set to true add the `#retained` flag.

```

```

### Subscribe

```



```

The last message to the topic will be save in `#lastMessage`. The `` stores the
last `n` messages within the `#messages` array. Set `#numberOfMessages` to the
number of messages that should be saved in `#messages`. To save every message received on the topic
set `#numberOfMessages` to `Infinity`.

## Media

* [MQTT Client Library Encyclopedia](http://www.hivemq.com/blog/mqtt-client-library-encyclopedia-mqttelements?utm_medium=social&utm_source=github-mqttjs)

## Development

```
mkdir mqtt-wrapper && cd mqtt-wrapper
git clone https://github.com/mqttjs/mqtt-elements.git
cd mqtt-elements
cp debug.bowerrc .bowerrc
npm install
bower install
grunt serve
```

#### Bundel MQTT.js, MQEmitter and Store

```
browserify -r ./node_modules/mqtt/lib/store.js:Store -r mqtt -r MQEmitter > dist/mqtt-elements-bundle.js

```