Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
react-native-find-local-devices
Advanced tools
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 34 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 healthy version release cadence and project activity because the last version was released less than 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.