Gathering detailed insights and metrics for react-native-paho-mqtt
Gathering detailed insights and metrics for react-native-paho-mqtt
Gathering detailed insights and metrics for react-native-paho-mqtt
Gathering detailed insights and metrics for react-native-paho-mqtt
npm install react-native-paho-mqtt
Typescript
Module System
Node Version
NPM Version
JavaScript (91.27%)
HTML (8.73%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
91 Stars
208 Commits
33 Forks
2 Watchers
6 Branches
1 Contributors
Updated on Oct 30, 2024
Latest Version
0.1.1
Package Id
react-native-paho-mqtt@0.1.1
Size
87.04 kB
NPM Version
3.10.3
Node Version
6.3.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
A fork of paho-client, this project exists to provide an ES6-ready, Promise-based, react-native compatible version of the Eclipse Paho client
Due to a React Native binary websocket bug, this library will not work with React Native 0.46.0 on Android, but should be ok on other platforms. RN 0.47 and RN<=0.45 are fine on all platforms as far as I know.
Reference documentation (for the base Paho client) is online at: http://www.eclipse.org/paho/files/jsdoc/index.html
The included code below is a very basic sample that connects to a server using WebSockets and subscribes to the topic World
, once subscribed, it then publishes the message Hello
to that topic. Any messages that come into the subscribed topic will be printed to the Javascript console.
This requires the use of a broker that supports WebSockets natively, or the use of a gateway that can forward between WebSockets and TCP.
1import { Client, Message } from 'react-native-paho-mqtt'; 2 3//Set up an in-memory alternative to global localStorage 4const myStorage = { 5 setItem: (key, item) => { 6 myStorage[key] = item; 7 }, 8 getItem: (key) => myStorage[key], 9 removeItem: (key) => { 10 delete myStorage[key]; 11 }, 12}; 13 14// Create a client instance 15const client = new Client({ uri: 'ws://iot.eclipse.org:80/ws', clientId: 'clientId', storage: myStorage }); 16 17// set event handlers 18client.on('connectionLost', (responseObject) => { 19 if (responseObject.errorCode !== 0) { 20 console.log(responseObject.errorMessage); 21 } 22}); 23client.on('messageReceived', (message) => { 24 console.log(message.payloadString); 25}); 26 27// connect the client 28client.connect() 29 .then(() => { 30 // Once a connection has been made, make a subscription and send a message. 31 console.log('onConnect'); 32 return client.subscribe('World'); 33 }) 34 .then(() => { 35 const message = new Message('Hello'); 36 message.destinationName = 'World'; 37 client.send(message); 38 }) 39 .catch((responseObject) => { 40 if (responseObject.errorCode !== 0) { 41 console.log('onConnectionLost:' + responseObject.errorMessage); 42 } 43 }) 44; 45
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 2/29 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
102 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More