Skip to content

Commit

Permalink
Add missing ping() method into WebSocket interface (#41071)
Browse files Browse the repository at this point in the history
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: #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
  • Loading branch information
alexzel authored and facebook-github-bot committed Nov 7, 2023
1 parent d11d5f3 commit 016b62c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/react-native/types/modules/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 016b62c

Please sign in to comment.