Skip to content

Conversation

@emily8rown
Copy link
Contributor

Summary:
The ws library's message event passes (data, isBinary) to callbacks, but the flow-typed definition only included data. This caused Flow errors when correctly using isBinary to detect binary messages.

This fix adds the missing isBinary: boolean parameter to ws$MessageListener in both flow-typed locations to keep them synchronized:

  • xplat/js/tools/metro/flow-typed/npm/ws_v7.x.x.js
  • xplat/js/react-native-github/flow-typed/npm/ws_v7.x.x.js

This is backwards compatible - existing code that doesn't use isBinary will continue to work since for flow a function with fewer parameters is a subtype for callbacks. websocket was always sending both parameters and the javascript just ignored the second one.

https://github.com/websockets/ws/blob/master/doc/ws.md#event-message

Reviewed By: huntie

Differential Revision: D90507002

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 13, 2026
@meta-codesync
Copy link

meta-codesync bot commented Jan 13, 2026

@emily8rown has exported this pull request. If you are a Meta employee, you can view the originating Diff in D90507002.

emily8rown added a commit to emily8rown/react-native that referenced this pull request Jan 13, 2026
Summary:

The `ws` library's `message` event passes `(data, isBinary)` to callbacks, but the flow-typed definition only included `data`. This caused Flow errors when correctly using `isBinary` to detect binary messages.

This fix adds the missing `isBinary: boolean` parameter to `ws$MessageListener` in both flow-typed locations to keep them synchronized:
- `xplat/js/tools/metro/flow-typed/npm/ws_v7.x.x.js`
- `xplat/js/react-native-github/flow-typed/npm/ws_v7.x.x.js`

This is backwards compatible - existing code that doesn't use `isBinary` will continue to work since for flow a function with fewer parameters is a subtype for callbacks. websocket was always sending both parameters and the javascript just ignored the second one.

https://github.com/websockets/ws/blob/master/doc/ws.md#event-message

Reviewed By: huntie

Differential Revision: D90507002
Summary:

Changelog: [Internal] - Add missing isBinary parameter to ws$MessageListener Flow type

The `ws` library's `message` event passes `(data, isBinary)` to callbacks, but the flow-typed definition only included `data`. This caused Flow errors when correctly using `isBinary` to detect binary messages.

This fix adds the missing `isBinary: boolean` parameter to `ws$MessageListener` in both flow-typed locations to keep them synchronized:
- `xplat/js/tools/metro/flow-typed/npm/ws_v7.x.x.js`
- `xplat/js/react-native-github/flow-typed/npm/ws_v7.x.x.js`

This is backwards compatible - existing code that doesn't use `isBinary` will continue to work since for flow a function with fewer parameters is a subtype for callbacks. websocket was always sending both parameters and the javascript just ignored the second one.

https://github.com/websockets/ws/blob/master/doc/ws.md#event-message

Reviewed By: huntie

Differential Revision: D90507002
meta-codesync bot pushed a commit to facebook/metro that referenced this pull request Jan 13, 2026
Summary:
X-link: facebook/react-native#55137

Changelog: [Internal] - Add missing isBinary parameter to ws$MessageListener Flow type

The `ws` library's `message` event passes `(data, isBinary)` to callbacks, but the flow-typed definition only included `data`. This caused Flow errors when correctly using `isBinary` to detect binary messages.

This fix adds the missing `isBinary: boolean` parameter to `ws$MessageListener` in both flow-typed locations to keep them synchronized:
- `xplat/js/tools/metro/flow-typed/npm/ws_v7.x.x.js`
- `xplat/js/react-native-github/flow-typed/npm/ws_v7.x.x.js`

This is backwards compatible - existing code that doesn't use `isBinary` will continue to work since for flow a function with fewer parameters is a subtype for callbacks. websocket was always sending both parameters and the javascript just ignored the second one.

https://github.com/websockets/ws/blob/master/doc/ws.md#event-message

Reviewed By: huntie

Differential Revision: D90507002

fbshipit-source-id: 6ab78809213ec167416de35a12cd1fe5c328046f
@meta-codesync meta-codesync bot closed this in a4bd79a Jan 13, 2026
@react-native-bot react-native-bot added the Merged This PR has been merged. label Jan 13, 2026
@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @emily8rown in a4bd79a

When will my fix make it into a release? | How to file a pick request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants