Redesigned how websockets connects and reconnect.