Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed WithOptions for WebSocket endpoint. #5879

Merged
merged 1 commit into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ public static GraphQLHttpEndpointConventionBuilder MapGraphQLHttp(
/// <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 IEndpointConventionBuilder MapGraphQLWebSocket(
/// <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 IEndpointConventionBuilder MapGraphQLWebSocket(
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
Original file line number Diff line number Diff line change
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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ protected virtual TestServer CreateStarWarsServer(
endpoints.MapGraphQL("/batching").
WithOptions(new GraphQLServerOptions
{

// with defaults
// EnableBatching = false
});
}));
}
Expand Down