According to engine.io doc, it looks like the socket no longer emits the upgrade event, so it should be removed from this example.
By the way, I would like to ask how I should add some verification information in the upgrade request header, and reject the upgrade if the verification information is illegal.