MQTT server on React Native
npm install react-native-mqtt-server
import { Server, SimpleMQBroker } from 'react-native-mqtt-server';
// Use simple broker
const broker = new SimpleMQBroker();
broker.start();
broker.on('connect', id => console.log('Client connected', id));
broker.on('message', (topic, payload) => console.log('Message received', topic, payload));
// Use as MQTT server directly
const server = new Server();
server.on('connection', client => {
client.on('data', packet => {
console.log('Packet received', packet);
});
});
server.listen(1883);
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library
Built and maintained by BRICKS.