* Creates a new socket for the given `nsp`. * * @return {Socket} * @public
(nsp: string, opts?: Partial<SocketOptions>)
| 463 | * @public |
| 464 | */ |
| 465 | public socket(nsp: string, opts?: Partial<SocketOptions>): Socket { |
| 466 | let socket = this.nsps[nsp]; |
| 467 | if (!socket) { |
| 468 | socket = new Socket(this, nsp, opts); |
| 469 | this.nsps[nsp] = socket; |
| 470 | } else if (this._autoConnect && !socket.active) { |
| 471 | socket.connect(); |
| 472 | } |
| 473 | |
| 474 | return socket; |
| 475 | } |
| 476 | |
| 477 | /** |
| 478 | * Called upon a socket close. |
no test coverage detected