| 764 | } |
| 765 | |
| 766 | async sendPing() { |
| 767 | if (this.props.connection.status !== 'connected') { |
| 768 | // This generally shouldn't happen because anything that changes the |
| 769 | // connection status should call stopPing(), but it's good to make sure |
| 770 | return; |
| 771 | } |
| 772 | const messageID = this.sendMessageWithoutID({ |
| 773 | type: clientSocketMessageTypes.PING, |
| 774 | }); |
| 775 | try { |
| 776 | invariant( |
| 777 | this.state.inflightRequests, |
| 778 | 'inflightRequests falsey inside sendPing', |
| 779 | ); |
| 780 | await this.state.inflightRequests.fetchResponse<PongServerSocketMessage>( |
| 781 | messageID, |
| 782 | serverSocketMessageTypes.PONG, |
| 783 | ); |
| 784 | } catch (e) {} |
| 785 | } |
| 786 | |
| 787 | setLateResponse: (messageID: number, isLate: boolean) => void = ( |
| 788 | messageID, |