Giter VIP home page Giter VIP logo

Comments (3)

mayteio avatar mayteio commented on May 25, 2024

It shouldn't do that, the whole point of websockets is that it's a long running connection. We're using it for connections that run overnight. Do you have a code sandbox you can send that I can look at?

from use-pusher.

carloquilala avatar carloquilala commented on May 25, 2024

I currently have no sandbox but I'll try to mock the scenario... I'm using JWT to authenticate

  1. user logs in with a token that expires in an hour (token_1)
  2. 5 minutes before the token expires, token will be refreshed to extend the user session (token_2)
  3. PusherProvider still uses auth header authorization bearer (token_1) but is now invalid when trying to authenticate again (subscribing to a new channel)

what I've tried

when the system calls an api to refresh, in my saga, I put first a null token, then put next a new token

problem is it renders twice, without PusherProvider and with PusherProvider so that it can authenticate with the new token (token_2)

UPDATE

please take a look of this example codesandbox... please take a look at the request header "Authorization" property

https://codesandbox.io/s/dazzling-haibt-06kbj

from use-pusher.

mayteio avatar mayteio commented on May 25, 2024

Hmmm, I see. The user only needs a pusher auth token once though - then the connection can stay live as long as they are active. Is the issue if, I.e. they lose wifi and reconnect, it has to get a new token because the old one might be stale?

I can’t really think of a simple way to fix this with authEndpoint. An authorizer might work better here.

from use-pusher.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.