leto
leto copied to clipboard
Close WebSocket error
An asynchronous error occurs when attempting to close a WebSocket connection in the GraphQL WebSocket handler. The error message is: Bad state: Cannot close sink while adding stream.
Code Excerpt
app.all(
'/$graphqlSubscriptionPath',
graphQLWebSocket(
letoGraphQL,
validateIncomingConnection: (
Map<String, Object?>? initialPayload,
GraphQLWebSocketShelfServer wsServer,
) async {
return false;
},
),
);
Error Message
Asynchronous error
Bad state: Cannot close sink while adding stream.
package:stream_channel/src/guarantee_channel.dart 180:7 _GuaranteeSink.close
package:async/src/delegate/stream_sink.dart 47:27 DelegatingStreamSink.close
package:web_socket_channel/adapter_web_socket_channel.dart 147:18 _WebSocketSink.close
package:leto/src/web_socket/server.dart 135:44 new GraphQLWebSocketServer.<fn>
Expected Behavior The WebSocket connection should be closed gracefully without any errors.
Actual Behavior An error occurs when attempting to close the WebSocket connection, indicating that the sink cannot be closed while adding a stream.