reverted back to ws.on check because browserify adds module.exports or something and this was failing for browser client