Azure node.js服务器和Hololens

Azure node.js服务器和Hololens,node.js,azure,unity3d,websocket,hololens,Node.js,Azure,Unity3d,Websocket,Hololens,我正在尝试连接到我的Node.js服务器,该服务器已作为Azure上的Web应用程序托管。我不确定我做错了什么或错过了什么 我的设置: 具有事件中心/物联网中心/webapp/存储的Azure帐户 向物联网中心发送数据的模拟设备 node.js服务器,连接iothub向Unity3D发送数据。 接收并显示数据的Unity3D应用程序-最终在Hololens上显示 目前我在本地机器上使用此代码,运行时没有任何缺陷- const Receiver = require('azure-iothu

我正在尝试连接到我的Node.js服务器,该服务器已作为Azure上的Web应用程序托管。我不确定我做错了什么或错过了什么

我的设置: 具有事件中心/物联网中心/webapp/存储的Azure帐户 向物联网中心发送数据的模拟设备 node.js服务器,连接iothub向Unity3D发送数据。 接收并显示数据的Unity3D应用程序-最终在Hololens上显示

目前我在本地机器上使用此代码,运行时没有任何缺陷-

    const Receiver = require('azure-iothub-receiver');
var io = require('socket.io')
var shortid = require('shortid');

var fs = require("fs"),
  WebSocket = require("ws"),
    WebSocketServer = require("ws").Server;

const PORT = process.env.PORT || 8080;
console.log(PORT);
console.log('Server started');

const options = {
  connectionString: 'XXXXXXXXX' 
};
const receiver = new Receiver(options);

var wss = new WebSocketServer({ port: PORT });
wss.on('connection', function(ws){
    console.log("Client connected");
    if (ws.readyState === WebSocket.OPEN) {
    var message = "Hello!";
    console.log("Send:", message);
}
      receiver.on('data', (message) => {
                console.log('body:', message.body.temperature);
              ws.send(message.body.temperature, { binary: false, mask: false });
        });
        ws.on("close", function () {
            console.log("Client disconnected");
        });
        ws.on("error", function (error) {
            console.log("Error: %s", error);
    })

});
在unity中,我使用来自的DeadlyFingers代码。在unity中,我输入我的webapp的IP地址,但它不连接

我不确定这里发生了什么。与我的本地计算机相比,从azure webaps部署服务器时是否需要对其进行不同的配置

我是否连接错误

谢谢,
Jared

我不知道DeadlyFingers,但是如果你自己使用WWW类提出请求,我相信它应该会起作用。WWW-Sample:太好了,我会试试看,你能不能找到解决办法,如果能,请告诉我我也遇到了同样的情况。我的目标是使用socket io连接hololens设备,并执行重启、关闭hololens等操作,任何github repo都会对我有帮助。根据我的经验,ThanksAzure基本服务计划根本不允许使用web套接字。