-
Notifications
You must be signed in to change notification settings - Fork 341
Reconnect after closing connection on client #161
Comments
Also very interested in this! Although I think a new websocket client must be created to reconnect. Maybe |
@carlosbergfeld @srtucker22 client = null; here: /~https://github.com/apollographql/subscriptions-transport-ws/blob/master/src/client.ts#L126 Will solve this issue? or i'm missing something? |
I mean, I think it should be fine, but just wanted to double check with you guys first because there might be flags that need resetting or something. If client is null, for example, |
@srtucker22 Please take a look at this PR: #164 |
Wow, so fast! Should solve it. I'll throw up a PR if something else pops up when I'm using it. Thanks! |
released in 0.7.1 |
I'm interested in using the
lazy
option to connect only once the user is authenticated and disconnect (wsClient.close()
) when they log out, so there are only authenticated connections. However, if someone logs in and subscribes from the same client afterwsClient.close()
has been called, I think it would make sense to be able to reconnect with the samewsClient
. As the code stands right now I'm not sure this is possible. It seems like a client was intended to be reusable afterclose()
.Maybe there's a better way to do what I'm trying? Maybe we could just change that conditional to check whether the client is null or closed? Maybe this will break other internal flags and things?
Let me know what's good.
The text was updated successfully, but these errors were encountered: