Closed ElectricCookie closed 1 month ago
Hey @ElectricCookie,
Thanks for the kind words.
The use case you just explained is completely valid and I'll add this.
@ElectricCookie I've released version 2.1.1
, which includes the reconnectHeaders
parameter in the reconnectConfig
object.
I considered adding the body and URL to reconnectConfig
, but that would essentially be connecting to a new endpoint rather than reconnecting to a recently disconnected one.
@Imgkl Thanks for the quick improvement! Would it be possible to make the headers (or reconnect config entirely) async? In many of my use cases I get an access token, which could require fetching a new one via a refresh token (which is an async network request).
Thanks again!
@ElectricCookie hmm.. I see.
Should be simple, I guess... I'll see what I can do here. Raising a new issue to track this.
Hi! Really great project! I love the convenient API and good documentation!
Maybe I'm missing something, but the auto-reconnect will always try the old header values. Since I'm passing an access token to the endpoint this token might have already expired by the time the reconnect is triggered.
Maybe it makes sense to replace/add the body / header / url parameters to be a callback that can be re-evaluated when the re-connect occurs?
Cheers