diff --git a/packages/api/amplify_api_dart/lib/src/graphql/web_socket/types/web_socket_types.dart b/packages/api/amplify_api_dart/lib/src/graphql/web_socket/types/web_socket_types.dart index 61b24c0b15..b10eb2f68f 100644 --- a/packages/api/amplify_api_dart/lib/src/graphql/web_socket/types/web_socket_types.dart +++ b/packages/api/amplify_api_dart/lib/src/graphql/web_socket/types/web_socket_types.dart @@ -61,6 +61,7 @@ abstract class WebSocketMessagePayload { MessageType.connectionAck: ConnectionAckMessagePayload.fromJson, MessageType.data: SubscriptionDataPayload.fromJson, MessageType.error: WebSocketError.fromJson, + MessageType.connectionError: WebSocketError.fromJson, }; static WebSocketMessagePayload? fromJson( diff --git a/packages/api/amplify_api_dart/test/web_socket/web_socket_types_test.dart b/packages/api/amplify_api_dart/test/web_socket/web_socket_types_test.dart index 0b5a3f116f..90e7489e1c 100644 --- a/packages/api/amplify_api_dart/test/web_socket/web_socket_types_test.dart +++ b/packages/api/amplify_api_dart/test/web_socket/web_socket_types_test.dart @@ -65,6 +65,21 @@ void main() { }, MessageType.error, ), + MessageTypeTestEntry( + { + 'id': 'abc-456', + 'type': 'connection_error', + 'payload': { + 'errors': [ + { + 'errorType': 'UnknownConnectionError', + 'message': 'Unknown connection id abc-456', + } + ], + }, + }, + MessageType.connectionError, + ), ]; group('WebSocketMessage should create expected messages from JSON', () {