Skip to content

Commit

Permalink
Fixed WithOptions for WebSocket endpoint. (#5879)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Feb 21, 2023
1 parent ea3361f commit 6015f20
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Expand Up @@ -199,7 +199,7 @@ public static class EndpointRouteBuilderExtensions
/// <exception cref="ArgumentNullException">
/// The <paramref name="endpointRouteBuilder" /> is <c>null</c>.
/// </exception>
public static IEndpointConventionBuilder MapGraphQLWebSocket(
public static WebSocketEndpointConventionBuilder MapGraphQLWebSocket(
this IEndpointRouteBuilder endpointRouteBuilder,
string pattern = _graphQLWebSocketPath,
string? schemaName = default)
Expand All @@ -224,7 +224,7 @@ public static class EndpointRouteBuilderExtensions
/// <exception cref="ArgumentNullException">
/// The <paramref name="endpointRouteBuilder" /> is <c>null</c>.
/// </exception>
public static IEndpointConventionBuilder MapGraphQLWebSocket(
public static WebSocketEndpointConventionBuilder MapGraphQLWebSocket(
this IEndpointRouteBuilder endpointRouteBuilder,
RoutePattern pattern,
string? schemaName = default)
Expand All @@ -251,10 +251,12 @@ public static class EndpointRouteBuilderExtensions
return Task.CompletedTask;
});

return new GraphQLEndpointConventionBuilder(
var builder = new GraphQLEndpointConventionBuilder(
endpointRouteBuilder
.Map(pattern, requestPipeline.Build())
.WithDisplayName("Hot Chocolate GraphQL WebSocket Pipeline"));

return new WebSocketEndpointConventionBuilder(builder);
}

/// <summary>
Expand Down
Expand Up @@ -20,8 +20,8 @@ public sealed class GraphQLSocketOptions
///
/// If the interval is set to null the server will send no keep alive messages.
///
/// Default: <c>TimeSpan.FromSeconds(30)</c>
/// Default: <c>TimeSpan.FromSeconds(5)</c>
/// </summary>
public TimeSpan? KeepAliveInterval { get; set; } =
TimeSpan.FromSeconds(30);
TimeSpan.FromSeconds(5);
}
Expand Up @@ -111,7 +111,8 @@ protected ServerTestBase(TestServerFactory serverFactory)
endpoints.MapGraphQL("/batching").
WithOptions(new GraphQLServerOptions
{
// with defaults
// EnableBatching = false
});
}));
}
Expand Down

0 comments on commit 6015f20

Please sign in to comment.