Skip to content

Commit

Permalink
feat(modv): Cyberpunk googles integration
Browse files Browse the repository at this point in the history
  • Loading branch information
TimPietrusky committed Aug 31, 2019
1 parent ef70cce commit b10caab
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion integration/modV/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,21 @@ console.log('modv-integration', '|', 'WebSocket server on port', port)
// Broadcast to all connected clients
server.connections.forEach(con => {

if (con.readyState !== con.OPEN) {
return
}

// The client connection came from luminave
if (con.path === '/luminave') {
con.sendText(JSON.stringify(dmxData))
}

// The client connection came from cyberpunk goggles
if (con.path === '/cyberpunk') {
const colors = JSON.stringify(dmxData.colors.slice(0, 3))
// console.log('send to cyberpunk', JSON.stringify(colors))
con.sendText(colors)
}
})
})

Expand All @@ -33,8 +44,14 @@ console.log('modv-integration', '|', 'WebSocket server on port', port)
})

connection.on('error', error => {
console.log('modv-integration', '|', 'Error by', connection.path, 'with code', error.code)

if (error.code === 'EHOSTDOWN' || error.code === 'ETIMEDOUT') {
return
}

// Ignore ECONNRESET and re throw anything else
if (error.code !== 'ECONNRESET') {
// Ignore ECONNRESET and re throw anything else
throw error
}
})
Expand Down

0 comments on commit b10caab

Please sign in to comment.