diff --git a/index.js b/index.js index a06ef48..9988598 100644 --- a/index.js +++ b/index.js @@ -25,10 +25,12 @@ io.on('connection', (socket) => { } } - socket.on('setFunctions', (...args) => { + socket.on('setFunctions', (jsonArray) => { + const parsed = JSON.parse(jsonArray) + functions = {} - for (const eachFuntion of args) { + for (const eachFuntion of parsed) { functions[eachFuntion] = (...args) => socket.emit(BRIDGE_PREFIX + eachFuntion, ...args) }