diff --git a/packages/graphql/lib/src/links/websocket_link/websocket_client.dart b/packages/graphql/lib/src/links/websocket_link/websocket_client.dart index b1e2e1f67..de8ce0c81 100644 --- a/packages/graphql/lib/src/links/websocket_link/websocket_client.dart +++ b/packages/graphql/lib/src/links/websocket_link/websocket_client.dart @@ -370,13 +370,18 @@ class SocketClient { } void _write(final GraphQLSocketMessage message) { - if (_connectionStateController.value == SocketConnectionState.connected) { - socketChannel!.sink.add( - json.encode( - message, - toEncodable: (dynamic m) => m.toJson(), - ), - ); + switch (_connectionStateController.value) { + case SocketConnectionState.connected: + case SocketConnectionState.handshake: + socketChannel!.sink.add( + json.encode( + message, + toEncodable: (dynamic m) => m.toJson(), + ), + ); + break; + default: + break; } }