连接成功后执行该函数。
socket.on('connect', () => { // ... }); // note: you should register event handlers outside of connect, // so they are not registered again on reconnection socket.on('myevent', () => { // ... });