Skip to content

feat: Make useSubscription return info about the subscription #5786

Closed

Description

@BeBoRE

Describe the feature you'd like to request

It's currently pretty difficult to tell whether a subscription is actually connected and listening for events. To track the status of the connection you would have to handle these events yourself. It would be nice if there was an easier way to track the status of the subscription.

Describe the solution you'd like to see

Have the useSubscription hook return the status of the connection.

const { status } = api.message.useSubscription();

if (status !== 'connected') return <p>You are currently not connected to the server :(</p>;

return <p>Connection active :D</p>;

Describe alternate solutions

Currently to show the user they are not connected to the service I am tracking the online status of the device, but this is only loosely correlated to actual status of the connection. This means that it will always show that the service is available when the device is online even while our service is down.

Additional information

No response

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR implementing this feature!

Activity

  1. added
    ✅ accepted-PRs-welcome
    on Jun 11, 2024
  2. github-actions commented on Oct 22, 2024

    @github-actions
    Contributor

    This issue has been locked because we are very unlikely to see comments on closed issues. If you are running into a similar issue, please create a new issue. Thank you.

  3. locked as resolved and limited conversation to collaborators on Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✅ accepted-PRs-welcome

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions