(
socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>,
fn: (
socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>
) => void
)
| 384 | } |
| 385 | |
| 386 | private _doConnect( |
| 387 | socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData>, |
| 388 | fn: ( |
| 389 | socket: Socket<ListenEvents, EmitEvents, ServerSideEvents, SocketData> |
| 390 | ) => void |
| 391 | ) { |
| 392 | // track socket |
| 393 | this.sockets.set(socket.id, socket); |
| 394 | |
| 395 | // it's paramount that the internal `onconnect` logic |
| 396 | // fires before user-set events to prevent state order |
| 397 | // violations (such as a disconnection before the connection |
| 398 | // logic is complete) |
| 399 | socket._onconnect(); |
| 400 | if (fn) fn(socket); |
| 401 | |
| 402 | // fire user-set events |
| 403 | this.emitReserved("connect", socket); |
| 404 | this.emitReserved("connection", socket); |
| 405 | } |
| 406 | |
| 407 | /** |
| 408 | * Removes a client. Called by each `Socket`. |
no test coverage detected