improve structure of socketHandler.js, add stubbs