Keep track of clients

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 ! :slight_smile:

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}

    }

}

What version of OSC are you using ? Your code works fine on v1.5.1.

I send osc messages from Max 8 on windows, via udpsend object. I don’t know what version is implemented in Max
What is strange is that the “clients” var remains empty even with several open browsers

Sorry I meant what version of Open Stage Control.

of course :confused: Sorry :slight_smile:
An old one ! (0.48.7)
I try with the update

ok now it works perfectly !
Thank you :slight_smile: