From 016b62c54985e92ce43a97a07b7830b546688221 Mon Sep 17 00:00:00 2001 From: Alex Zelensky Date: Tue, 7 Nov 2023 05:34:01 -0800 Subject: [PATCH] Add missing ping() method into WebSocket interface (#41071) Summary: The `ping()` method seems missing in `WebSocket` interface. The implementation can be found in different places : https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/websocket/WebSocketModule.java#L323 https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/WebSocket/NativeWebSocketModule.js#L24 https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/WebSocket/WebSocket.js#L209 The change adds missing `ping()` method into `WebSocket` TypeScript interface. ## Changelog: [GENERAL] [FIXED] - Add missing `ping()` method into `WebSocket` interface Pull Request resolved: https://github.com/facebook/react-native/pull/41071 Test Plan: Running `yarn test-typescript` and `yarn test-typescript-offline` works with no errors. Reviewed By: NickGerleman Differential Revision: D50975349 Pulled By: javache fbshipit-source-id: fc3d62091f7a1543ac92faa1bd9a804c699f725d --- packages/react-native/types/modules/globals.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/react-native/types/modules/globals.d.ts b/packages/react-native/types/modules/globals.d.ts index af112c7698aec5..51272890300db7 100644 --- a/packages/react-native/types/modules/globals.d.ts +++ b/packages/react-native/types/modules/globals.d.ts @@ -460,6 +460,7 @@ interface WebSocket extends EventTarget { readonly readyState: number; send(data: string | ArrayBuffer | ArrayBufferView | Blob): void; close(code?: number, reason?: string): void; + ping(): void; onopen: (() => void) | null; onmessage: ((event: WebSocketMessageEvent) => void) | null; onerror: ((event: WebSocketErrorEvent) => void) | null;