clean up the websockets code