Skip to content

Instantly share code, notes, and snippets.

@eklimcz-zz
Last active February 12, 2018 08:46
Show Gist options
  • Save eklimcz-zz/225d4617cc10e40b3053 to your computer and use it in GitHub Desktop.
Save eklimcz-zz/225d4617cc10e40b3053 to your computer and use it in GitHub Desktop.
Basic scanning with Noble
var noble = require('noble');
//replace localhost with your server's IP;
var socket = require('socket.io-client')('http://localhost/scanner');
//replace with your hardware address
var addressToTrack = '7c669d9b2dda';
socket.on('connect', function(){
console.log('connected to server');
});
noble.on('discover', function(peripheral){
if(peripheral.uuid == addressToTrack){
socket.emit('deviceData', {mac: peripheral.uuid, rssi:peripheral.rssi});
}
});
noble.startScanning([], true) //allows dubplicates while scanning
@Vineetsai
Copy link

Is it possible for you to share code for original beacon tracking project.

@leiw324
Copy link

leiw324 commented Feb 12, 2018

After run this script that do not show connected to server in Linux console, please help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment