'use strict'; let iosocket = io.connect(); // setup all my handlers iosocket.on('clientrefresh', () => { location.reload(); }); iosocket.on('stateChange', (state) => { console.log(state); // basically the server tracks the state since it is the same for al clients // So we know that we HAVE to update at this point $('#team-container').bracket({init: state}); }); $( document ).ready(function() { // get my state let context = 'main'; iosocket.emit('loadState',context); });