graphql-platform
graphql-platform copied to clipboard
#strawberry-shake how can I reconnect websocket if somehow Server is Restarted and connection is lost
Is there an existing issue for this?
- [x] I have searched the existing issues
Describe the bug
#strawberry-shake how can I reconnect websocket if somehow Server is Restarted and connection is lost
There should be onConnect and OnDisconnet events callbacks.
Steps to reproduce
My Startup as per documentation
services.AddBkClient(profile: BkClient.BkClientProfileKind.Default).ConfigureHttpClient((sp , client) =>
{
var login = sp.GetService<Login>( );
_token = login.GetAccessToken( );
client.BaseAddress = new Uri(_appSettings.BkQueryUrl);
client.AddBearerToken(_token);
}).ConfigureWebSocketClient((sp , client) =>
{
client.Uri = new Uri(_appSettings.BkWsUrl);
});
Relevant log output
No response
Additional Context?
No response
Product
Strawberry Shake
Version
11.3.5
@tobias-tengler Do we have any work around for now? To reconnect websocket and getting subscriptions live.
We will have a look at this issue next week.
The GraphQL.Net client exposes a WebsocketConnectionState property that can be subscribed to. This is super useful when you need to synchronize data after connectivity issues. Would be great if Strawberry Shake could offer something similar
@ibnekhalid i have an open issue with subscriptions as well. #4303 I made an example to demonstrate the issue.
This example also contain a workaround for broken connection detection. Maybe it is helpful for you as well. https://github.com/horego/hotchocolate-graphql-examples realized with an DeadSocketConnectionInterceptor
best regards
@horego thanks, but for now i have implemented SignalR (with websocket connection) until the issue is not resolved. Once the issue would be resolved i would move to the #StrawberryShake Subscriptions again.
@horego, You are observing socket connection on Client side only but i need to capture Disconnect on Server also.
@michaelstaib, i know you people are working on other millstones also. Are you people done with this issue?
Thanks?
I have a interim solution. Look at #5006 .
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue make the whole feature of subscriptions more or less unusable, no? That's great for things that complete in a short time, but for any long lived subscriptions, an absence of automatic reconnexion / notification mechanism is really wrong. :/ Does something prevent to apply the CoreDX9 solution of completing the subscription on case of disconnection?
Need to add that the two workarounds I've found here seem outdated and does not work properly.
@fhewitt do you want to help on this? We have started work on a new underlying socket handling but any help is welcome.
I am facing connection issues as well and trying to figure out how to reconnect the websocket connection. For cases when internet drops or when auth token expires, I wanted to be able to check and reconnect if the web socket connection is disrupted or if not successful. I also notice that the WebSocket client's state would go on Aborted state and have no clue why when how that happened.
I tried the GraphQL.Net client and did not face these issues. Would be great if Strawberry Shake can have an OnError or OnDisconnected event or an observable that can subscribed to so that a proper handling can be done.
Much better if it would reconnect automatically.
I am facing connection issues as well and trying to figure out how to reconnect the websocket connection. For cases when internet drops or when auth token expires, I wanted to be able to check and reconnect if the web socket connection is disrupted or if not successful. I also notice that the WebSocket client's state would go on Aborted state and have no clue why when how that happened.
I tried the GraphQL.Net client and did not face these issues. Would be great if Strawberry Shake can have an OnError or OnDisconnected event or an observable that can subscribed to so that a proper handling can be done.
Much better if it would reconnect automatically.
I am running into the same issue. where is able to identify a solution or a workaround?
@gowthambala unfortunately, we had to postpone the usage of strawberry shake on our project due to the issue mentioned above. But now, we have to try again but looks like there are no fixes/updates made yet.
@fhewitt do you want to help on this? We have started work on a new underlying socket handling but any help is welcome.
@michaelstaib are there any updates on possible solution/workaround for the reconnection issue?
@JenMQ - did you get this working?