Closed catapop84 closed 10 months ago
Sometimes we make updates to our server and we need to reset the program. On closing server sends close code 1002 and no reason. This way we can override if we choose to to reconnect once the server is rebooted. This will also make the library in line with the javascript equivalent .
PS. I know this might be confusing, but this PR is for the new websocket protocol: graphql-transport-ws
from the library graphql-ws
@juancastillo0 what do you think?
Hi! Looks great! The implementation is a little different form the reference, but the differences make sense. There are no additional tests, however the changes are kind of incremental.
Not sure if we should treat it as a breaking change, since the close reason was non-nullable. We could also make it non-null and pass an empty String (or the close code as a String) when the server does not return a reason, but I personally don't like it. And I suppose it would still be a breaking change since the TransportWsClientOptions
has a new field and it could be implemented, but I believe it would be less common.
If we make a breaking change maybe we could accommodate other changes like this one https://github.com/gql-dart/gql/issues/411#issuecomment-1666551422 and I am not sure what is the status of this PR https://github.com/gql-dart/gql/pull/412.
In general I think it could be merge, not sure what you think about the test and the breaking change.
@catapop84 please pull the latest changes from master to CI succeeds
@knaeckeKami done
@knaeckeKami can you try one more time. Should be valid this time.
This PR fixes 2 problems
reason: socket.closeReason!
is expected to exists.isFatalConnectionProblem
Based on their documentation: https://github.com/enisdenjo/graphql-ws/blob/master/src/client.ts , shouldRetry can override fatal close code which is the default implementation.