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 authored Feb 21, 2023
1 parent ea3361f commit 6015f20
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
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

0 comments on commit 6015f20

Please sign in to comment.