how to know when websocket upgrade fails in socket.io

i am using socket.io in a simple javascript app. I want to alert the user when upgrade to websocket fails due to any reason and HTTP long-polling is used as a fallback, so user knows that connection is not optimal.

I have read the socket.io documentation, websocket upgrade troubleshoot page and faq page. I know when upgrade to websocket is successful (e.g. socket.io.engine.on("upgrade", () => {});, but I don’t find the opposite there.