Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/grails/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
访问/处理ArrayBuffer@http客户端(websocket连接,JavaScript)_Javascript_Arraybuffer - Fatal编程技术网

访问/处理ArrayBuffer@http客户端(websocket连接,JavaScript)

访问/处理ArrayBuffer@http客户端(websocket连接,JavaScript),javascript,arraybuffer,Javascript,Arraybuffer,我有一个websocket连接 •节点服务器(+socket.io) •浏览器 从服务器向浏览器发送消息(来自Arduino的Udp消息) 结果:没有数据打印到浏览器 问题:我做错了什么?我还尝试了其他数据视图,但没有成功。它快把我逼疯了。请帮忙 udpSocket.on("message", function (msg, rinfo) { for (i = 0; i < msg.length; i++) { co

我有一个websocket连接 •节点服务器(+socket.io) •浏览器

从服务器向浏览器发送消息(来自Arduino的Udp消息)

结果:没有数据打印到浏览器

问题:我做错了什么?我还尝试了其他数据视图,但没有成功。它快把我逼疯了。请帮忙

udpSocket.on("message", function (msg, rinfo) {                          
    for (i = 0; i < msg.length; i++) {
        console.log(msg.readInt8(i)); 
}
    console.log("");     
    io.sockets.emit('message', msg);
});
socket.on('message', function(message) {
    document.getElementById("ko1").innerHTML = message;
})

<p> Arduino sends: </p>
<p id="ko1"> <br>
socket.on('message', function(message) {
    var uint8 = new Uint8Array(message);
    document.getElementById("ko1").innerHTML = uint8[0];
})