refactor web socket + authentication on websocket