不明白为什么我没有从我的 raspberry pi 3 接收到我的服务器的任何 rssi 数据

Not understanding why I am not receiving any rssi data from my raspberry pi 3 to my server

我在尝试显示来自 raspberry pi 3 的 RSSI 值以显示在我的服务器上时遇到问题。 Connection Success 如图所示,我已经成功连接了我的客户端和服务器,但没有显示 rssi 数据。

下面的代码是我在pi上执行的:

var noble = require('noble');

//replace localhost with your server's IP;
var socket = require('socket.io-client')('http://localhost:3000/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) 

下一个代码是我用来设置服务器的代码,以及它应该如何接收从 pi 发送的信息:

var express = require('express');
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);

var scanner = io.of('/scanner'); 

scanner.on('connection', function(socket) {

    console.log('Scanner Connected');

    socket.on('message', function(msg) {
        //received message from scanner
        //do some processing here
    });

    socket.on('disconnect', function() {
        console.log('Scanner Disconnected');
    });
});

http.listen(3000, function() {
    console.log('listening on *:3000');
});

以下代码摘自 https://blog.truthlabs.com/beacon-tracking-with-node-js-and-raspberry-pi-794afa880318 如果您想知道我从哪里引用代码。

我对这一切都是陌生的,如果我不断要求澄清,请原谅。

您在服务器上缺少 deviceData 的侦听器,这是您从客户端发出的事件。

socket.on('deviceData', function(msg) {
    //received message from scanner
    //do some processing here
});