Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V6- Hub is not handling "No Internet" case #13215

Open
3 tasks done
rkvirajgupta opened this issue Apr 3, 2024 · 3 comments
Open
3 tasks done

V6- Hub is not handling "No Internet" case #13215

rkvirajgupta opened this issue Apr 3, 2024 · 3 comments
Assignees
Labels
GraphQL Related to GraphQL API issues Hub Related to Hub category investigating This issue is being investigated to-be-reproduced Used in order for Amplify to reproduce said issue

Comments

@rkvirajgupta
Copy link

rkvirajgupta commented Apr 3, 2024

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

GraphQL API

Amplify Version

v6

Amplify Categories

api

Backend

None

Environment information

# Put output below this line


Describe the bug

V6- Hub is not handling "No Internet" case.

Expected behavior

It should give an event that the connection is interrupted.
Screenshot_1

Reproduction steps

setup hub connection with graphql subscription. after that Just connect with the mobile wifi and disable the mobile Internet connection(see attached image). you will not get any events for this that connection is established but there is no data transfer in it.

Code Snippet

Hub.listen('api', data => {
    const {payload} = data;
    if (payload.event === CONNECTION_STATE_CHANGE) {
      const connectionState = payload.data.connectionState;
      console.log(connectionState )
      if (connectionState === 'Connected' && isNetworkAvailable === false) {
        setIsNetworkAvailable(true);
      }
      if (
        connectionState == 'ConnectedPendingNetwork' ||
        connectionState == 'ConnectionDisrupted' ||
        connectionState == 'ConnectionDisruptedPendingNetwork'
      ) {
        setIsNetworkAvailable(false);
      }
    }
  });

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

@rkvirajgupta rkvirajgupta added the pending-triage Issue is pending triage label Apr 3, 2024
@rkvirajgupta
Copy link
Author

None of the below events are triggered in No-Internet case

Connected - Connected and working with no issues.
ConnectedPendingDisconnect - The connection has no active subscriptions and is disconnecting.
ConnectedPendingKeepAlive - The connection is open, but has missed expected keep-alive messages.
ConnectedPendingNetwork - The connection is open, but the network connection has been disrupted. When the network recovers, the connection will continue serving traffic.
Connecting - Attempting to connect.
ConnectionDisrupted - The connection is disrupted and the network is available.
ConnectionDisruptedPendingNetwork - The connection is disrupted and the network connection is unavailable.
Disconnected - Connection has no active subscriptions and is disconnecting.

@cwomack cwomack self-assigned this Apr 3, 2024
@cwomack cwomack added Hub Related to Hub category GraphQL Related to GraphQL API issues labels Apr 3, 2024
@cwomack cwomack assigned chrisbonifacio and unassigned cwomack Apr 4, 2024
@chrisbonifacio
Copy link
Contributor

chrisbonifacio commented Apr 8, 2024

Hi @rkvirajgupta can you let us know what operating system + browser you are using to reproduce this issue?
Can you also confirm that your subscription is working before the connection is disabled?

If you have any code that we can use to reproduce the issue, please share that as well.

Lastly, by "No internet" case, are you referring to the Windows OS wifi task bar's description of "No internet"? Judging from the screenshot that seems to be the case but I wonder if you are able to reproduce this on a different device with no connection such as a mobile or macOS device.

@chrisbonifacio chrisbonifacio added to-be-reproduced Used in order for Amplify to reproduce said issue investigating This issue is being investigated and removed pending-triage Issue is pending triage labels Apr 8, 2024
@rkvirajgupta
Copy link
Author

rkvirajgupta commented Apr 10, 2024

@chrisbonifacio The OS is windows 10 & broswer is chrome.

Can you also confirm that your subscription is working before the connection is disabled?
Yes, the subscription restarts when the network is available in every case but the event is not coming in HUB

If you have any code that we can use to reproduce the issue, please share that as well.
I already shared a code snippet where it should send me an event that the connection is interrupted similar to other internet connection issues(already shared refer to my 2nd comment).

Lastly, I generated this issue using a mobile hotspot connected to my laptop and then I switch off my mobile data (Internet connection), and only the hotspot was still active on my mobile. after that, you will see the attached screenshot type, No-Internet case.

Let me know if you have any other questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GraphQL Related to GraphQL API issues Hub Related to Hub category investigating This issue is being investigated to-be-reproduced Used in order for Amplify to reproduce said issue
Projects
None yet
Development

No branches or pull requests

3 participants