Skip to content

Native websockets for Android#268

Draft
tim-becker wants to merge 1 commit into
coredevices:masterfrom
tim-becker:android-native-websockets
Draft

Native websockets for Android#268
tim-becker wants to merge 1 commit into
coredevices:masterfrom
tim-becker:android-native-websockets

Conversation

@tim-becker

@tim-becker tim-becker commented Jun 24, 2026

Copy link
Copy Markdown

Fixes #245

  • Add native Android WebSocket support for PKJS to avoid WebView-originated Origin: null headers.
  • Share the WebSocket JS shim between Android and iOS.
  • Align Android and iOS native WebSocket lifecycle behavior.
  • Fix close() during CONNECTING so it dispatches close and cannot later dispatch open.
  • Validate WebSocket URLs, subprotocols, close codes, close reasons, and negotiated subprotocols on the native side.
  • Guard native bridge calls against duplicate connect and send-before-open cases.
  • Preserve binary/text message transfer through the native bridge.
  • Add focused Android instrumentation coverage for:
    • no Origin header
    • subprotocol preservation
    • JS-to-native and native-to-JS messages
    • close during CONNECTING
    • unexpected negotiated subprotocol rejection

- Add native Android WebSocket support for PKJS to avoid WebView-originated `Origin: null` headers.
- Share the WebSocket JS shim between Android and iOS.
- Align Android and iOS native WebSocket lifecycle behavior.
- Fix `close()` during `CONNECTING` so it dispatches close and cannot later dispatch open.
- Validate WebSocket URLs, subprotocols, close codes, close reasons, and negotiated subprotocols on the native side.
- Guard native bridge calls against duplicate connect and send-before-open cases.
- Preserve binary/text message transfer through the native bridge.
- Add focused Android instrumentation coverage for:
  - no `Origin` header
  - subprotocol preservation
  - JS-to-native and native-to-JS messages
  - close during `CONNECTING`
  - unexpected negotiated subprotocol rejection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Android PKJS WebSocket sends Origin: null

1 participant