Hi
Is the SocketIO DAT in the current build still using v2.x version of SocketIO?
I’m not getting a connection to my server buts its made with 4.x
I don’t really need the features so could roll back if needed but want to make sure its that and not something else first.
Its 2.x and not camptaible with 3.x+
adding this for the benefit of those in the future - to get a socketIO DAT working (using a node.js server setup), you just need to add an arguement to your server declaration to force backward compatibility with socketio v2
full server code below, sending a message with dummy data to port 3001 (on localhost in this case)
const { Server } = require("socket.io");
let testObject = {
name: "sensordata",
numbers: {
a: 0.5656456456,
b: 0.4534534534,
c: 0.3452352352,
d: 0.2423423423,
e: 0.2312412412
}
}
const io = new Server(3001, {
allowEIO3: true // THIS IS WHAT YOU NEED TO ADD TO ENSURE TD COMPATIBILITY
});
io.on("connection", (socket) => {
console.log("Received socket connection!");
setTimeout(sendData, 16);
});
function sendData() {
io.emit("tdstream", testObject);
testObject.numbers.a += .0001;
testObject.numbers.b += .0001;
testObject.numbers.c += .0001;
testObject.numbers.d += .0001;
testObject.numbers.e += .0001;
setTimeout(sendData, 16);
}
then just listen for an event called ‘tdstream’ in your socketIO dat by connecting a table dat with ‘tdstream’ as the only entry to the socketIO dat’s second input
1 Like