https://github.com/mybigday/react-native-mqtt-server
MQTT server on React Native
https://github.com/mybigday/react-native-mqtt-server
mqtt-broker mqtt-server react-native
Last synced: about 1 year ago
JSON representation
MQTT server on React Native
- Host: GitHub
- URL: https://github.com/mybigday/react-native-mqtt-server
- Owner: mybigday
- License: mit
- Created: 2023-06-15T01:06:35.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-09-20T19:15:52.000Z (almost 3 years ago)
- Last Synced: 2025-05-01T14:18:51.594Z (about 1 year ago)
- Topics: mqtt-broker, mqtt-server, react-native
- Language: TypeScript
- Homepage:
- Size: 1.09 MB
- Stars: 2
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# react-native-mqtt-server
MQTT server on React Native
## Installation
```sh
npm install react-native-mqtt-server
```
## Usage
```js
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);
```
## Contributing
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
## License
MIT
---
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
---
Built and maintained by BRICKS.