Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.
/ wt-mqtt Public archive

MQTT Client for the browser & React Native

Notifications You must be signed in to change notification settings

Wraptime/wt-mqtt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

MQTT Client

MQTT Client for the browser & React Native

This is an export of the MQTT.js library, but exported with Webpack as a CommonJS module for ease of use.

Installation

$ npm i --save wt-mqtt

Usage (ES6)

import mqtt from 'wt-mqtt'

...

var client = mqtt.connect('ws://localhost:3000')

client.subscribe('mqtt/demo')

client.on('connect', () => {
  console.log('mqtt connected')
})

client.on('message', (topic, payload) => {
  console.log([topic, payload].join(': '))
  client.end()
})

client.publish('mqtt/demo', 'hello world!')

Server

We use Mosca as our MQTT broker. Read this wiki for a guide of setting up Mosca over WebSockets.

About

MQTT Client for the browser & React Native

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published