Hello,
I’m trying to get a list of all devices currently connected to the server.
I used the example of custom module with just a simple modification.
But the received message remains empty :
OSC sent: { address: ‘/connecte’, args: [ { type: ‘s’, value: ‘[]’ } ] } To: 192.168.1.174:9090
Thank you for your help !
The custom module :
// keep track of connected clients
var clients = []
app.on('open', (data, client)=>{
if (!clients.includes(client.id)) clients.push(client.id)
})
app.on('close', (data, client)=>{
if (clients.includes(client.id)) clients.splice(clients.indexOf(client.id))
})
module.exports = {
oscInFilter:function(data){
var {address, args, host, port} = data
if (address === '/hello') {
// simulate user input on the first client in the array
send(host,9090,'/connecte', clients)
return // bypass original message
}
return {address, args, host, port}
}
}