websocket architecture refactoring