* Clears the acknowledgement handlers upon disconnection, since the client will never receive an acknowledgement from * the server. * * @private
()
| 677 | * @private |
| 678 | */ |
| 679 | private _clearAcks() { |
| 680 | Object.keys(this.acks).forEach((id) => { |
| 681 | const isBuffered = this.sendBuffer.some( |
| 682 | (packet) => String(packet.id) === id, |
| 683 | ); |
| 684 | if (!isBuffered) { |
| 685 | // note: handlers that do not accept an error as first argument are ignored here |
| 686 | const ack = this.acks[id]; |
| 687 | delete this.acks[id]; |
| 688 | |
| 689 | if (ack.withError) { |
| 690 | ack.call(this, new Error("socket has been disconnected")); |
| 691 | } |
| 692 | } |
| 693 | }); |
| 694 | } |
| 695 | |
| 696 | /** |
| 697 | * Called with socket packet. |
no test coverage detected