Skip to content

connectionTimeout does not work correctly on React Native Android (works on iOS) #740

@mayurkadampro

Description

@mayurkadampro

We are using @stomp/stompjs in a React Native application to connect to a WebSocket endpoint for FX streaming.

We have configured the connectionTimeout option in the Client configuration. The expected behavior is that if the WebSocket connection is not established within the specified timeout, the client should fail the connection attempt and trigger the appropriate error or reconnection logic.

However, this behavior works correctly on iOS but does not work on Android.

On Android, when the connection hangs (e.g., due to network issues, DNS delay, SSL handshake delay, or unreachable host), the connectionTimeout does not trigger as expected. The WebSocket remains stuck in the CONNECTING state and no timeout error is raised.

Environment
@stomp/stompjs: 7.0.0
React Native: 0.83.1
Platform:
✅ iOS – works as expected
❌ Android – timeout not triggered
Transport
Native WebSocket (React Native global WebSocket)

Actual Behavior when connection not establish yet (Android Only)
WebSocket remains in CONNECTING state
connectionTimeout does not fire
No error callback is triggered
Reconnect logic does not start
Manual intervention is required to close the socket

The issue does not reproduce on iOS.
Updating to the latest version of @stomp/stompjs did not resolve the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions