Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
react-native-find-local-devices
Advanced tools
It can be helpful when you try to get a list of your local devices over WiFi with websocket connection.
Weekly downloads
Readme
It can be helpful when you try to get a list of your local devices over WiFi when the devices includes at least one websocket connection.
This package allows you detect all devices over your local network with websocket connection.
You've to add a timeout and an array of ports as parameters. The package will try to create a connection with those ports and return the ip adresses which have successful connection.
See the example: https://github.com/RichardRNStudio/react-native-find-local-devices/tree/main/example
NOTICE: It doesn't work with IOS yet. If you can help me in this case please contact me on the following email: info@rnstudio.hu
This package has been written for the PC Controller react-native application as a submodule.
Visit the PC Controller website
npm install react-native-find-local-devices --save
NOTICE: It requires a real device with Wi-Fi connection
npm run example:android
import FindLocalDevices from 'react-native-find-local-devices';
import { DeviceEventEmitter } from 'react-native';
// Don't forget to call DeviceEventEmitter.removeAllListeners() when discovering isn't running.
// WARNING: DeviceEventEmitter.removeAllListeners will remove all of your listeners.
// See the example folder. There is an advanced example how you can create
// and remove listeners independent of any other listeners.
// MAIN BEHAVIOUR:
// ...
DeviceEventEmitter.addListener('NEW_DEVICE_FOUND', (device) => {
console.log(`NEW DEVICE FOUND: ${device.ipAddress}:${device.port}`);
// This listener will be activated at the moment when the device has been found.
// FORMAT: {ipAddress: "192.168.1.66", port: 70}
});
DeviceEventEmitter.addListener('RESULTS', (devices) => {
// ALL OF RESULTS when discovering has been finished.
// FORMAT: [{ipAddress: "192.168.1.66", port: 70}, {ipAddress: "192.168.1.69", port: 85}]
});
DeviceEventEmitter.addListener('CHECK', (device) => {
// This listener will be activated in that moment when package checking a device.
// FORMAT: {ipAddress: "192.168.1.65", port: 70}
});
DeviceEventEmitter.addListener('NO_DEVICES', () => {
// This listener will be activated at the end of discovering.
});
DeviceEventEmitter.addListener('NO_PORTS', () => {
// This listener will be activated if you don't pass any ports to the package.
});
DeviceEventEmitter.addListener('CONNECTION_ERROR', (error) => {
// Handle error messages for each socket connection
// console.log(error.message);
});
// Getting local devices which have active socket server on the following ports:
FindLocalDevices.getLocalDevices({
ports: [70, 85, 1200],
timeout: 40
});
// When the discovering is running, you can cancel that with the following function:
FindLocalDevices.cancelDiscovering();
// ...
// ...
const newDeviceFoundSubscription = DeviceEventEmitter.addListener(
NEW_DEVICE_FOUND,
(device) => {
if (device.ipAddress && device.port) {
console.log(device);
}
}
);
// ...
if(newDeviceFoundSubscription) newDeviceFoundSubscription.remove();
// ...
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
FAQs
It can be helpful when you try to get a list of your local devices over WiFi with websocket connection.
The npm package react-native-find-local-devices receives a total of 16 weekly downloads. As such, react-native-find-local-devices popularity was classified as not popular.
We found that react-native-find-local-devices demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.