All Projects → AnxiousDarkly → React Native Mqtt

AnxiousDarkly / React Native Mqtt

Licence: mit
Mqtt client for react native.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Mqtt

wave
MQTT Broker - for IoT, DIY, pubsub applications and more
Stars: ✭ 24 (-80.33%)
Mutual labels:  websockets, broker
Mqttnet
MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
Stars: ✭ 2,486 (+1937.7%)
Mutual labels:  mqtt-client, broker
Mqtt Panel
A web interface for MQTT
Stars: ✭ 315 (+158.2%)
Mutual labels:  mqtt-client, websockets
MQTTnet
MQTTnet is a high performance .NET library for MQTT based communication. It provides a MQTT client and a MQTT server (broker). The implementation is based on the documentation from http://mqtt.org/.
Stars: ✭ 3,309 (+2612.3%)
Mutual labels:  broker, mqtt-client
Pmq
信也科技MQ消息系统
Stars: ✭ 333 (+172.95%)
Mutual labels:  mqtt-client, broker
Atmosphere Javascript
atmosphere-javascript
Stars: ✭ 108 (-11.48%)
Mutual labels:  websockets
Webpack Hot Client
webpack HMR Client
Stars: ✭ 116 (-4.92%)
Mutual labels:  websockets
Nest
A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications on top of TypeScript & JavaScript (ES6, ES7, ES8) 🚀
Stars: ✭ 42,981 (+35130.33%)
Mutual labels:  websockets
Qewd
Quick and Easy Web Development
Stars: ✭ 106 (-13.11%)
Mutual labels:  websockets
Go Realtime Collaborative Drawing App
A simple real-time collaborative drawing app built with Go
Stars: ✭ 121 (-0.82%)
Mutual labels:  websockets
Mphx
A little library to let you make multiplayer games easily with Haxe. No longer maintained and better options are available.
Stars: ✭ 118 (-3.28%)
Mutual labels:  websockets
Spec
The AsyncAPI specification allows you to create machine-readable definitions of your asynchronous APIs.
Stars: ✭ 1,860 (+1424.59%)
Mutual labels:  websockets
Colyseus Examples
Colyseus Game Server examples for learning purposes
Stars: ✭ 109 (-10.66%)
Mutual labels:  websockets
Next Todos
200 lines realtime todos app powered by next.js, preact, jet, redux and now
Stars: ✭ 117 (-4.1%)
Mutual labels:  websockets
Entangled
Rails in real time
Stars: ✭ 108 (-11.48%)
Mutual labels:  websockets
Coogleiot
A ESP8266 Library for easy IOT device development
Stars: ✭ 118 (-3.28%)
Mutual labels:  mqtt-client
Webfluxtemplate
Spring Webflux template application with working Spring Security, Web-sockets, Rest, Web MVC, and Authentication with JWT.
Stars: ✭ 107 (-12.3%)
Mutual labels:  websockets
Anycable
Polyglot replacement for Ruby WebSocket servers with Action Cable protocol
Stars: ✭ 1,610 (+1219.67%)
Mutual labels:  websockets
Live Mutex
High-performance networked mutex for Node.js libraries.
Stars: ✭ 118 (-3.28%)
Mutual labels:  broker
Ventas
Clojure ecommerce platform
Stars: ✭ 114 (-6.56%)
Mutual labels:  websockets

Build Status npm version

React Native Mqtt

This package is a wrapper around the javascript implementation of the paho mqtt client library to provide drop in compatibility with react native. If you happen to be running your own mqtt broker, it must support websockets for a connection to be possible.

Install

To install, use npm:

npm install react_native_mqtt --save

Usage

To use the library just pass in the options for the local storage module (react-native-storage) and the paho object will be attached to global scope.

import init from 'react_native_mqtt';
import { AsyncStorage } from 'react-native';

init({
  size: 10000,
  storageBackend: AsyncStorage,
  defaultExpires: 1000 * 3600 * 24,
  enableCache: true,
  reconnect: true,
  sync : {
  }
});

function onConnect() {
  console.log("onConnect");
}

function onConnectionLost(responseObject) {
  if (responseObject.errorCode !== 0) {
    console.log("onConnectionLost:"+responseObject.errorMessage);
  }
}

function onMessageArrived(message) {
  console.log("onMessageArrived:"+message.payloadString);
}

const client = new Paho.MQTT.Client('iot.eclipse.org', 443, 'uname');
client.onConnectionLost = onConnectionLost;
client.onMessageArrived = onMessageArrived;
client.connect({ onSuccess:onConnect, useSSL: true });

Example

To run the example, first make sure you have properly setup your env for react native development in ios and/or android: https://facebook.github.io/react-native/releases/0.21/docs/getting-started.html.

Then start the tsc compiler to watch and re-build changes, start up the js packager, and run android or ios.

cd /react-native-mqtt/
yarn
yarn run dev
cd /react-native-mqtt/example/
yarn
yarn start --reset-cache
cd /react-native-mqtt/example/
react-native run-android OR react-native run-ios

Lastly, once you have the example running, you can use this web app to verify that everything works as expected by publishing messages to the "WORLD" topic, using the config below.

Host: iot.eclipse.org
Port: 443
SSL: true
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].