468 references to HttpTransportType
JwtClientSample (5)
Program.cs (5)
17
app.RunConnection(
HttpTransportType
.WebSockets),
18
app.RunConnection(
HttpTransportType
.ServerSentEvents),
19
app.RunConnection(
HttpTransportType
.LongPolling));
26
private async Task RunConnection(
HttpTransportType
transportType)
62
if (transportType !=
HttpTransportType
.WebSockets)
Microsoft.AspNetCore.Http.Connections (54)
Features\IHttpTransportFeature.cs (3)
9
/// Feature set on the <see cref="ConnectionContext"/> that exposes the <see cref="
HttpTransportType
"/>
15
/// The <see cref="
HttpTransportType
"/> the connection is using.
17
HttpTransportType
TransportType { get; }
HttpConnectionDispatcherOptions.cs (2)
46
/// Gets or sets a bitmask combining one or more <see cref="
HttpTransportType
"/> values that specify what transports the server should use to receive HTTP requests.
48
public
HttpTransportType
Transports { get; set; }
Internal\HttpConnectionContext.cs (13)
121
public
HttpTransportType
TransportType { get; set; }
280
if (TransportType ==
HttpTransportType
.LongPolling && User?.Identity is WindowsIdentity)
305
if (TransportType ==
HttpTransportType
.WebSockets)
555
if (UseStatefulReconnect && TransportType ==
HttpTransportType
.WebSockets)
584
internal SetTransportState TrySetTransport(
HttpTransportType
transportType, HttpConnectionsMetrics metrics)
588
if (TransportType ==
HttpTransportType
.None)
629
Debug.Assert(TransportType !=
HttpTransportType
.None, "Transport has not been initialized yet");
754
return UseStatefulReconnect == true || TransportType ==
HttpTransportType
.LongPolling;
776
public static partial void WaitingForTransport(ILogger logger,
HttpTransportType
transportType);
779
public static partial void TransportComplete(ILogger logger,
HttpTransportType
transportType);
782
public static partial void ShuttingDownTransportAndApplication(ILogger logger,
HttpTransportType
transportType);
785
public static partial void WaitingForTransportAndApplication(ILogger logger,
HttpTransportType
transportType);
788
public static partial void TransportAndApplicationComplete(ILogger logger,
HttpTransportType
transportType);
Internal\HttpConnectionDispatcher.cs (21)
24
Transport = nameof(
HttpTransportType
.WebSockets),
31
Transport = nameof(
HttpTransportType
.ServerSentEvents),
38
Transport = nameof(
HttpTransportType
.LongPolling),
126
var
supportedTransports = options.Transports;
142
if (!await EnsureConnectionStateAsync(connection, context,
HttpTransportType
.ServerSentEvents, supportedTransports, logScope))
166
var
transport =
HttpTransportType
.LongPolling;
169
transport =
HttpTransportType
.WebSockets;
199
if (connection.TransportType !=
HttpTransportType
.WebSockets || connection.UseStatefulReconnect)
215
case
HttpTransportType
.None:
217
case
HttpTransportType
.WebSockets:
231
case
HttpTransportType
.LongPolling:
283
if (transport !=
HttpTransportType
.LongPolling)
424
if ((options.Transports &
HttpTransportType
.WebSockets) != 0 && ServerHasWebSockets(context.Features))
429
if ((options.Transports &
HttpTransportType
.ServerSentEvents) != 0)
434
if ((options.Transports &
HttpTransportType
.LongPolling) != 0)
460
if (connection.TransportType ==
HttpTransportType
.WebSockets)
552
if (connection.TransportType !=
HttpTransportType
.LongPolling)
570
private async Task<bool> EnsureConnectionStateAsync(HttpConnectionContext connection, HttpContext context,
HttpTransportType
transportType,
HttpTransportType
supportedTransports, ConnectionLogScope logScope)
606
if (transportType ==
HttpTransportType
.LongPolling)
Internal\HttpConnectionDispatcher.Log.cs (4)
31
public static partial void TransportNotSupported(ILogger logger,
HttpTransportType
transportType);
34
public static partial void CannotChangeTransport(ILogger logger,
HttpTransportType
transportType,
HttpTransportType
requestedTransport);
43
public static partial void ReceivedDeleteRequestForUnsupportedTransport(ILogger logger,
HttpTransportType
transportType);
Internal\HttpConnectionManager.cs (2)
88
public void RemoveConnection(string id,
HttpTransportType
transportType, HttpConnectionStopStatus status)
95
if (connection.TransportType !=
HttpTransportType
.None)
Internal\HttpConnectionsMetrics.cs (9)
45
public void ConnectionStop(in MetricsContext metricsContext,
HttpTransportType
transportType, HttpConnectionStopStatus status, long startTimestamp, long currentTimestamp)
56
public void ConnectionTransportStart(in MetricsContext metricsContext,
HttpTransportType
transportType)
58
Debug.Assert(transportType !=
HttpTransportType
.None);
67
public void TransportStop(in MetricsContext metricsContext,
HttpTransportType
transportType)
73
if (transportType !=
HttpTransportType
.None)
80
private static string ResolveTransportType(
HttpTransportType
transportType)
84
HttpTransportType
.ServerSentEvents => "server_sent_events",
85
HttpTransportType
.LongPolling => "long_polling",
86
HttpTransportType
.WebSockets => "web_sockets",
Microsoft.AspNetCore.Http.Connections.Client (38)
HttpConnection.cs (15)
107
/// <param name="transports">A bitmask combining one or more <see cref="
HttpTransportType
"/> values that specify what transports the client should use.</param>
108
public HttpConnection(Uri url,
HttpTransportType
transports)
117
/// <param name="transports">A bitmask combining one or more <see cref="
HttpTransportType
"/> values that specify what transports the client should use.</param>
119
public HttpConnection(Uri url,
HttpTransportType
transports, ILoggerFactory? loggerFactory)
124
private static HttpConnectionOptions CreateHttpOptions(Uri url,
HttpTransportType
transports)
151
if (!httpConnectionOptions.SkipNegotiation || httpConnectionOptions.Transports !=
HttpTransportType
.WebSockets)
156
if (httpConnectionOptions.Transports ==
HttpTransportType
.ServerSentEvents && OperatingSystem.IsBrowser())
314
if (_httpConnectionOptions.Transports ==
HttpTransportType
.WebSockets)
367
if (!Enum.TryParse<
HttpTransportType
>(transport.Transport, out
var
transportType))
374
if (transportType ==
HttpTransportType
.WebSockets && !IsWebSocketsSupported())
381
if (transportType ==
HttpTransportType
.ServerSentEvents && OperatingSystem.IsBrowser())
406
_httpConnectionOptions.UseStatefulReconnect = transportType ==
HttpTransportType
.WebSockets ? _httpConnectionOptions.UseStatefulReconnect : false;
518
private async Task StartTransport(Uri connectUrl,
HttpTransportType
transportType, TransferFormat transferFormat,
538
_hasInherentKeepAlive = transportType ==
HttpTransportType
.LongPolling;
HttpConnection.Log.cs (6)
33
public static void StartingTransport(ILogger logger,
HttpTransportType
transportType, Uri url)
54
public static partial void ErrorStartingTransport(ILogger logger,
HttpTransportType
transport, Exception exception);
59
public static void TransportDoesNotSupportTransferFormat(ILogger logger,
HttpTransportType
transport, TransferFormat transferFormat)
72
public static void TransportDisabledByClient(ILogger logger,
HttpTransportType
transport)
83
public static void TransportFailed(ILogger logger,
HttpTransportType
transport, Exception ex)
101
public static partial void TransportStarted(ILogger logger,
HttpTransportType
transport);
HttpConnectionOptions.cs (3)
171
/// Gets or sets a bitmask combining one or more <see cref="
HttpTransportType
"/> values that specify what transports the client should use to send HTTP requests.
173
public
HttpTransportType
Transports { get; set; }
179
/// Negotiation can only be skipped when using the <see cref="
HttpTransportType
.WebSockets"/> transport.
Internal\DefaultTransportFactory.cs (13)
16
private readonly
HttpTransportType
_requestedTransportType;
20
public DefaultTransportFactory(
HttpTransportType
requestedTransportType, ILoggerFactory loggerFactory, HttpClient? httpClient, HttpConnectionOptions httpConnectionOptions, Func<Task<string?>> accessTokenProvider)
22
if (httpClient == null && requestedTransportType !=
HttpTransportType
.WebSockets)
24
throw new ArgumentException($"{nameof(httpClient)} cannot be null when {nameof(requestedTransportType)} is not {nameof(
HttpTransportType
.WebSockets)}.", nameof(httpClient));
34
public ITransport CreateTransport(
HttpTransportType
availableServerTransports, bool useStatefulReconnect)
36
if (_websocketsSupported && (availableServerTransports &
HttpTransportType
.WebSockets & _requestedTransportType) ==
HttpTransportType
.WebSockets)
44
Log.TransportNotSupported(_loggerFactory.CreateLogger<DefaultTransportFactory>(),
HttpTransportType
.WebSockets, ex);
49
if ((availableServerTransports &
HttpTransportType
.ServerSentEvents & _requestedTransportType) ==
HttpTransportType
.ServerSentEvents)
55
if ((availableServerTransports &
HttpTransportType
.LongPolling & _requestedTransportType) ==
HttpTransportType
.LongPolling)
67
public static partial void TransportNotSupported(ILogger logger,
HttpTransportType
transportType, Exception ex);
Internal\ITransportFactory.cs (1)
8
ITransport CreateTransport(
HttpTransportType
availableServerTransports, bool useStatefulReconnect);
Microsoft.AspNetCore.Http.Connections.Common (5)
HttpTransports.cs (5)
12
/// A bitmask combining all available <see cref="
HttpTransportType
"/> values.
14
public static readonly
HttpTransportType
All =
HttpTransportType
.WebSockets |
HttpTransportType
.ServerSentEvents |
HttpTransportType
.LongPolling;
Microsoft.AspNetCore.Http.Connections.Tests (148)
HttpConnectionDispatcherTests.cs (146)
198
[InlineData(
HttpTransportType
.LongPolling)]
199
[InlineData(
HttpTransportType
.ServerSentEvents)]
200
public async Task CheckThatThresholdValuesAreEnforcedWithSends(
HttpTransportType
transportType)
252
[InlineData(
HttpTransportType
.LongPolling |
HttpTransportType
.WebSockets |
HttpTransportType
.ServerSentEvents)]
253
[InlineData(
HttpTransportType
.None)]
254
[InlineData(
HttpTransportType
.LongPolling |
HttpTransportType
.WebSockets)]
255
public async Task NegotiateReturnsAvailableTransportsAfterFilteringByOptions(
HttpTransportType
transports)
275
var
availableTransports =
HttpTransportType
.None;
278
var
transportType = (
HttpTransportType
)Enum.Parse(typeof(
HttpTransportType
), transport.Value<string>("transport"));
287
[InlineData(
HttpTransportType
.WebSockets)]
288
[InlineData(
HttpTransportType
.ServerSentEvents)]
289
[InlineData(
HttpTransportType
.LongPolling)]
290
public async Task EndpointsThatAcceptConnectionId404WhenUnknownConnectionIdProvided(
HttpTransportType
transportType)
324
if (transportType ==
HttpTransportType
.LongPolling)
376
connection.TransportType =
HttpTransportType
.WebSockets;
414
connection.TransportType =
HttpTransportType
.LongPolling;
444
[InlineData(
HttpTransportType
.ServerSentEvents)]
445
[InlineData(
HttpTransportType
.WebSockets)]
446
public async Task TransportEndingGracefullyWaitsOnApplication(
HttpTransportType
transportType)
515
connection.TransportType =
HttpTransportType
.LongPolling;
520
SetTransport(context,
HttpTransportType
.LongPolling);
571
[InlineData(
HttpTransportType
.LongPolling)]
572
[InlineData(
HttpTransportType
.ServerSentEvents)]
573
public async Task PostSendsToConnection(
HttpTransportType
transportType)
621
[InlineData(
HttpTransportType
.LongPolling)]
622
[InlineData(
HttpTransportType
.ServerSentEvents)]
623
public async Task PostSendsToConnectionInParallel(
HttpTransportType
transportType)
715
connection.TransportType =
HttpTransportType
.LongPolling;
749
connection.TransportType =
HttpTransportType
.LongPolling;
842
[InlineData(
HttpTransportType
.ServerSentEvents)]
843
[InlineData(
HttpTransportType
.LongPolling)]
844
public async Task EndpointsThatRequireConnectionId400WhenNoConnectionIdProvided(
HttpTransportType
transportType)
873
if (transportType ==
HttpTransportType
.LongPolling)
882
[InlineData(
HttpTransportType
.LongPolling)]
883
[InlineData(
HttpTransportType
.ServerSentEvents)]
884
public async Task IOExceptionWhenReadingRequestReturns400Response(
HttpTransportType
transportType)
951
[InlineData(
HttpTransportType
.LongPolling, 200)]
952
[InlineData(
HttpTransportType
.WebSockets, 404)]
953
[InlineData(
HttpTransportType
.ServerSentEvents, 404)]
954
public async Task EndPointThatOnlySupportsLongPollingRejectsOtherTransports(
HttpTransportType
transportType, int status)
958
await CheckTransportSupported(
HttpTransportType
.LongPolling, transportType, status, LoggerFactory);
963
[InlineData(
HttpTransportType
.ServerSentEvents, 200)]
964
[InlineData(
HttpTransportType
.WebSockets, 404)]
965
[InlineData(
HttpTransportType
.LongPolling, 404)]
966
public async Task EndPointThatOnlySupportsSSERejectsOtherTransports(
HttpTransportType
transportType, int status)
970
await CheckTransportSupported(
HttpTransportType
.ServerSentEvents, transportType, status, LoggerFactory);
975
[InlineData(
HttpTransportType
.WebSockets, 200)]
976
[InlineData(
HttpTransportType
.ServerSentEvents, 404)]
977
[InlineData(
HttpTransportType
.LongPolling, 404)]
978
public async Task EndPointThatOnlySupportsWebSockesRejectsOtherTransports(
HttpTransportType
transportType, int status)
982
await CheckTransportSupported(
HttpTransportType
.WebSockets, transportType, status, LoggerFactory);
987
[InlineData(
HttpTransportType
.LongPolling, 404)]
988
public async Task EndPointThatOnlySupportsWebSocketsAndSSERejectsLongPolling(
HttpTransportType
transportType, int status)
992
await CheckTransportSupported(
HttpTransportType
.WebSockets |
HttpTransportType
.ServerSentEvents, transportType, status, LoggerFactory);
1010
SetTransport(context,
HttpTransportType
.ServerSentEvents);
1042
SetTransport(context,
HttpTransportType
.ServerSentEvents);
1063
connection.TransportType =
HttpTransportType
.LongPolling;
1186
connection.TransportType =
HttpTransportType
.LongPolling;
1283
connection.TransportType =
HttpTransportType
.LongPolling;
1328
SetTransport(context,
HttpTransportType
.ServerSentEvents);
1373
SetTransport(context,
HttpTransportType
.WebSockets, sync);
1406
connection.TransportType =
HttpTransportType
.WebSockets;
1413
SetTransport(context,
HttpTransportType
.WebSockets);
1428
[InlineData(
HttpTransportType
.WebSockets)]
1429
[InlineData(
HttpTransportType
.ServerSentEvents)]
1430
public async Task RequestToActiveConnectionId409ForStreamingTransports(
HttpTransportType
transportType)
1481
connection.TransportType =
HttpTransportType
.LongPolling;
1546
connection.TransportType =
HttpTransportType
.LongPolling;
1602
[InlineData(
HttpTransportType
.ServerSentEvents)]
1603
[InlineData(
HttpTransportType
.LongPolling)]
1604
public async Task RequestToDisposedConnectionIdReturns404(
HttpTransportType
transportType)
1627
if (transportType ==
HttpTransportType
.LongPolling)
1641
connection.TransportType =
HttpTransportType
.LongPolling;
1682
SetTransport(context,
HttpTransportType
.ServerSentEvents);
1710
connection.TransportType =
HttpTransportType
.LongPolling;
1752
connection.TransportType =
HttpTransportType
.LongPolling;
1790
[InlineData(
HttpTransportType
.LongPolling, null)]
1791
[InlineData(
HttpTransportType
.ServerSentEvents, TransferFormat.Text)]
1792
[InlineData(
HttpTransportType
.WebSockets, TransferFormat.Binary | TransferFormat.Text)]
1793
public async Task TransferModeSet(
HttpTransportType
transportType, TransferFormat? expectedTransferFormats)
1831
connection.TransportType =
HttpTransportType
.LongPolling;
1883
connection.TransportType =
HttpTransportType
.LongPolling;
1929
[InlineData(
HttpTransportType
.LongPolling)]
1930
[InlineData(
HttpTransportType
.ServerSentEvents)]
1931
[InlineData(
HttpTransportType
.WebSockets)]
1932
public async Task WindowsIdentityNotClosed(
HttpTransportType
transportType)
1957
if (transportType ==
HttpTransportType
.LongPolling)
1968
if (transportType ==
HttpTransportType
.LongPolling)
1983
connection.TransportType =
HttpTransportType
.LongPolling;
2007
[InlineData(
HttpTransportType
.ServerSentEvents)]
2008
[InlineData(
HttpTransportType
.WebSockets)]
2009
public async Task DeleteEndpointRejectsRequestToTerminateNonLongPollingTransport(
HttpTransportType
transportType)
2056
connection.TransportType =
HttpTransportType
.LongPolling;
2109
connection.TransportType =
HttpTransportType
.LongPolling;
2162
connection.TransportType =
HttpTransportType
.LongPolling;
2210
var
transportType =
HttpTransportType
.LongPolling;
2274
await dispatcher.ExecuteNegotiateAsync(context, new HttpConnectionDispatcherOptions { Transports =
HttpTransportType
.WebSockets });
2380
connection.TransportType =
HttpTransportType
.WebSockets;
2386
SetTransport(context,
HttpTransportType
.WebSockets);
2420
SetTransport(context,
HttpTransportType
.WebSockets);
2460
SetTransport(context,
HttpTransportType
.WebSockets);
2499
SetTransport(context,
HttpTransportType
.WebSockets);
2550
connection.TransportType =
HttpTransportType
.LongPolling;
2612
connection.TransportType =
HttpTransportType
.LongPolling;
2669
connection.TransportType =
HttpTransportType
.LongPolling;
2728
connection.TransportType =
HttpTransportType
.LongPolling;
2768
connection.TransportType =
HttpTransportType
.LongPolling;
2824
SetTransport(context,
HttpTransportType
.ServerSentEvents);
2851
SetTransport(context,
HttpTransportType
.WebSockets);
2881
SetTransport(context,
HttpTransportType
.WebSockets);
2930
SetTransport(context,
HttpTransportType
.ServerSentEvents);
2957
connection.TransportType =
HttpTransportType
.LongPolling;
3008
connection.TransportType =
HttpTransportType
.LongPolling;
3063
connection.TransportType =
HttpTransportType
.LongPolling;
3117
SetTransport(context,
HttpTransportType
.ServerSentEvents);
3148
connection.TransportType =
HttpTransportType
.LongPolling;
3189
[InlineData(
HttpTransportType
.LongPolling)]
3190
[InlineData(
HttpTransportType
.ServerSentEvents)]
3191
[InlineData(
HttpTransportType
.WebSockets)]
3192
public async Task AuthenticationExpirationSetOnAuthenticatedConnectionWithJWT(
HttpTransportType
transportType)
3289
[InlineData(
HttpTransportType
.LongPolling)]
3290
[InlineData(
HttpTransportType
.ServerSentEvents)]
3291
[InlineData(
HttpTransportType
.WebSockets)]
3292
public async Task AuthenticationExpirationSetOnAuthenticatedConnectionWithCookies(
HttpTransportType
transportType)
3351
[InlineData(
HttpTransportType
.LongPolling)]
3352
[InlineData(
HttpTransportType
.ServerSentEvents)]
3353
[InlineData(
HttpTransportType
.WebSockets)]
3354
public async Task AuthenticationExpirationUsesCorrectScheme(
HttpTransportType
transportType)
3489
[InlineData(
HttpTransportType
.ServerSentEvents)]
3490
[InlineData(
HttpTransportType
.WebSockets)]
3491
public async Task RequestTimeoutDisabledWhenConnected(
HttpTransportType
transportType)
3576
connection.TransportType =
HttpTransportType
.LongPolling;
3686
private static async Task CheckTransportSupported(
HttpTransportType
supportedTransports,
HttpTransportType
transportType, int status, ILoggerFactory loggerFactory)
3727
if (transportType ==
HttpTransportType
.LongPolling)
3754
private static void SetTransport(HttpContext context,
HttpTransportType
transportType, SyncPoint sync = null)
3758
case
HttpTransportType
.WebSockets:
3761
case
HttpTransportType
.ServerSentEvents:
MapConnectionHandlerTests.cs (2)
323
options.Transports =
HttpTransportType
.ServerSentEvents;
343
Assert.Equal(
HttpTransportType
.ServerSentEvents, optionsMetaData.Transports);
Microsoft.AspNetCore.SignalR.Client (9)
HubConnectionBuilderHttpExtensions.cs (9)
64
/// <param name="transports">A bitmask combining one or more <see cref="
HttpTransportType
"/> values that specify what transports the client should use.</param>
66
public static IHubConnectionBuilder WithUrl(this IHubConnectionBuilder hubConnectionBuilder, [StringSyntax(StringSyntaxAttribute.Uri)] string url,
HttpTransportType
transports)
77
/// <param name="transports">A bitmask combining one or more <see cref="
HttpTransportType
"/> values that specify what transports the client should use.</param>
80
public static IHubConnectionBuilder WithUrl(this IHubConnectionBuilder hubConnectionBuilder, [StringSyntax(StringSyntaxAttribute.Uri)] string url,
HttpTransportType
transports, Action<HttpConnectionOptions> configureHttpConnection)
116
/// <param name="transports">A bitmask combining one or more <see cref="
HttpTransportType
"/> values that specify what transports the client should use.</param>
118
public static IHubConnectionBuilder WithUrl(this IHubConnectionBuilder hubConnectionBuilder, Uri url,
HttpTransportType
transports)
129
/// <param name="transports">A bitmask combining one or more <see cref="
HttpTransportType
"/> values that specify what transports the client should use.</param>
132
public static IHubConnectionBuilder WithUrl(this IHubConnectionBuilder hubConnectionBuilder, Uri url,
HttpTransportType
transports, Action<HttpConnectionOptions> configureHttpConnection)
138
private static IHubConnectionBuilder WithUrlCore(this IHubConnectionBuilder hubConnectionBuilder, Uri url,
HttpTransportType
? transports, Action<HttpConnectionOptions>? configureHttpConnection)
Microsoft.AspNetCore.SignalR.Client.FunctionalTests (98)
HubConnectionTests.cs (83)
37
HttpTransportType
? transportType = null,
60
transportType ??=
HttpTransportType
.LongPolling |
HttpTransportType
.WebSockets |
HttpTransportType
.ServerSentEvents;
73
private static Func<EndPoint, ValueTask<ConnectionContext>> GetHttpConnectionFactory(string url, ILoggerFactory loggerFactory, string path,
HttpTransportType
transportType, TransferFormat transferFormat)
90
public async Task CheckFixedMessage(string protocolName,
HttpTransportType
transportType, string path)
136
.WithUrl(server.Url + "/negotiateProtocolVersion12",
HttpTransportType
.LongPolling);
166
.WithUrl(server.Url + "/negotiateProtocolVersionNegative",
HttpTransportType
.LongPolling);
189
public async Task CanSendAndReceiveMessage(string protocolName,
HttpTransportType
transportType, string path)
223
var connection = CreateHubConnection(server.Url, "/default",
HttpTransportType
.LongPolling, protocol, LoggerFactory);
247
public async Task CanStopAndStartConnection(string protocolName,
HttpTransportType
transportType, string path)
279
public async Task CanAccessConnectionIdFromHubConnection(string protocolName,
HttpTransportType
transportType, string path)
314
public async Task CanStartConnectionFromClosedEvent(string protocolName,
HttpTransportType
transportType, string path)
376
public async Task MethodsAreCaseInsensitive(string protocolName,
HttpTransportType
transportType, string path)
406
public async Task CanInvokeFromOnHandler(string protocolName,
HttpTransportType
transportType, string path)
446
public async Task StreamAsyncCoreTest(string protocolName,
HttpTransportType
transportType, string path)
486
var connection = CreateHubConnection(server.Url, "/default",
HttpTransportType
.WebSockets, protocol, LoggerFactory);
527
public async Task StreamAsyncTest(string protocolName,
HttpTransportType
transportType, string path)
562
public async Task StreamAsyncDoesNotStartIfTokenAlreadyCanceled(string protocolName,
HttpTransportType
transportType, string path)
599
public async Task StreamAsyncCanBeCanceled(string protocolName,
HttpTransportType
transportType, string path)
641
public async Task StreamAsyncWithException(string protocolName,
HttpTransportType
transportType, string path)
683
public async Task CanInvokeClientMethodFromServer(string protocolName,
HttpTransportType
transportType, string path)
717
public async Task InvokeNonExistantClientMethodFromServer(string protocolName,
HttpTransportType
transportType, string path)
759
public async Task CanStreamClientMethodFromServer(string protocolName,
HttpTransportType
transportType, string path)
789
public async Task CanStreamToAndFromClientInSameInvocation(string protocolName,
HttpTransportType
transportType, string path)
826
public async Task CanStreamToServerWithIAsyncEnumerable(string protocolName,
HttpTransportType
transportType, string path)
873
public async Task CanCancelIAsyncEnumerableClientToServerUpload(string protocolName,
HttpTransportType
transportType, string path)
926
public async Task StreamAsyncCanBeCanceledThroughGetAsyncEnumerator(string protocolName,
HttpTransportType
transportType, string path)
967
public async Task CanCloseStreamMethodEarly(string protocolName,
HttpTransportType
transportType, string path)
1008
public async Task StreamDoesNotStartIfTokenAlreadyCanceled(string protocolName,
HttpTransportType
transportType, string path)
1037
public async Task ExceptionFromStreamingSentToClient(string protocolName,
HttpTransportType
transportType, string path)
1071
public async Task ServerThrowsHubExceptionIfHubMethodCannotBeResolved(string hubProtocolName,
HttpTransportType
transportType, string hubPath)
1098
public async Task ServerThrowsHubExceptionIfHubMethodCannotBeResolvedAndArgumentsPassedIn(string hubProtocolName,
HttpTransportType
transportType, string hubPath)
1130
var connection = CreateHubConnection(server.Url, "/default",
HttpTransportType
.LongPolling, hubProtocol, LoggerFactory);
1152
public async Task ServerThrowsHubExceptionOnHubMethodArgumentTypeMismatch(string hubProtocolName,
HttpTransportType
transportType, string hubPath)
1179
public async Task ServerThrowsHubExceptionIfStreamingHubMethodCannotBeResolved(string hubProtocolName,
HttpTransportType
transportType, string hubPath)
1207
public async Task ServerThrowsHubExceptionOnStreamingHubMethodArgumentCountMismatch(string hubProtocolName,
HttpTransportType
transportType, string hubPath)
1235
public async Task ServerThrowsHubExceptionOnStreamingHubMethodArgumentTypeMismatch(string hubProtocolName,
HttpTransportType
transportType, string hubPath)
1263
public async Task ServerThrowsHubExceptionIfNonStreamMethodInvokedWithStreamAsync(string hubProtocolName,
HttpTransportType
transportType, string hubPath)
1290
public async Task ServerThrowsHubExceptionIfStreamMethodInvokedWithInvoke(string hubProtocolName,
HttpTransportType
transportType, string hubPath)
1317
public async Task ServerThrowsHubExceptionIfBuildingAsyncEnumeratorIsNotPossible(string hubProtocolName,
HttpTransportType
transportType, string hubPath)
1362
var connection = CreateHubConnection(server.Url, "/default",
HttpTransportType
.WebSockets, protocol, LoggerFactory);
1416
var connection = CreateHubConnection(server.Url, "/default",
HttpTransportType
.LongPolling, protocol, LoggerFactory);
1455
var
transportType = TransportTypes().First().Cast<
HttpTransportType
>().First();
1472
public async Task ClientCanUseJwtBearerTokenForAuthentication(
HttpTransportType
transportType)
1510
public async Task ClientWillFailAuthEndPointIfNotAuthorized(
HttpTransportType
transportType, string hubPath)
1537
public async Task ClientCanUseJwtBearerTokenForAuthenticationWhenRedirected(
HttpTransportType
transportType)
1565
public async Task ClientCanSendHeaders(
HttpTransportType
transportType)
1602
.WithUrl(server.Url + "/default",
HttpTransportType
.LongPolling, options =>
1644
.WithUrl(server.Url + "/default",
HttpTransportType
.LongPolling, options =>
1679
.WithUrl(server.Url + "/default",
HttpTransportType
.LongPolling, options =>
1719
.WithUrl(server.Url + "/default",
HttpTransportType
.WebSockets, options =>
1761
.WithUrl(server.Url + "/default",
HttpTransportType
.WebSockets, options =>
1802
public async Task TransportFallsbackFromHttp2WhenUsingCredentials(
HttpTransportType
httpTransportType)
1879
.WithUrl(server.Url + "/windowsauthhub",
HttpTransportType
.WebSockets, options =>
1922
.WithUrl(server.Url + "/default",
HttpTransportType
.WebSockets, options =>
1975
.WithUrl(server.Url + "/default",
HttpTransportType
.WebSockets)
2077
var
transport = await hubConnection.InvokeAsync<
HttpTransportType
>(nameof(TestHub.GetActiveTransportName)).DefaultTimeout();
2078
Assert.Equal(
HttpTransportType
.LongPolling, transport);
2102
options.Transports =
HttpTransportType
.LongPolling;
2135
public async Task CanAutomaticallyReconnect(
HttpTransportType
transportType)
2268
.WithUrl(server.Url + HubPaths.First(),
HttpTransportType
.WebSockets)
2323
public async Task CanBlockOnAsyncOperationsWithOneAtATimeSynchronizationContext(
HttpTransportType
transportType)
2379
.WithUrl(server.Url + "/default",
HttpTransportType
.LongPolling, o => o.HttpMessageHandlerFactory = h =>
2432
.WithUrl(server.Url + "/default",
HttpTransportType
.LongPolling, o => o.HttpMessageHandlerFactory = h =>
2475
.WithUrl(server.Url + "/default",
HttpTransportType
.ServerSentEvents, o => o.HttpMessageHandlerFactory = h =>
2525
.WithUrl(server.Url + "/default",
HttpTransportType
.ServerSentEvents, o => o.HttpMessageHandlerFactory = h =>
2563
.WithUrl(server.Url + "/default",
HttpTransportType
.WebSockets, o =>
2621
.WithUrl(server.Url + "/default",
HttpTransportType
.WebSockets, o =>
2691
.WithUrl(server.Url + "/default",
HttpTransportType
.WebSockets, o =>
2760
.WithUrl(server.Url + "/default",
HttpTransportType
.WebSockets, o =>
2813
.WithUrl(server.Url + "/default",
HttpTransportType
.WebSockets);
2866
.WithUrl(server.Url + "/default",
HttpTransportType
.WebSockets, o =>
2996
foreach (
var
transport in TransportTypes().SelectMany(t => t).Cast<
HttpTransportType
>())
3000
if (!(protocol.Value is MessagePackHubProtocol) || transport !=
HttpTransportType
.ServerSentEvents)
3012
foreach (
var
transport in TransportTypes().SelectMany(t => t).Cast<
HttpTransportType
>())
3047
yield return new object[] {
HttpTransportType
.WebSockets };
3049
yield return new object[] {
HttpTransportType
.ServerSentEvents };
3050
yield return new object[] {
HttpTransportType
.LongPolling };
HubConnectionTests.Tracing.cs (6)
30
public async Task InvokeAsync_SendTraceHeader(string protocolName,
HttpTransportType
transportType, string path)
224
public async Task StreamAsyncCore_SendTraceHeader(string protocolName,
HttpTransportType
transportType, string path)
369
public async Task StreamAsyncCanBeCanceled_Tracing(string protocolName,
HttpTransportType
transportType, string path)
466
public async Task StreamAsyncWithException_Tracing(string protocolName,
HttpTransportType
transportType, string path)
562
public async Task InvokeAsyncWithException_Tracing(string protocolName,
HttpTransportType
transportType, string path)
658
public async Task SendAsync_Tracing(string protocolName,
HttpTransportType
transportType, string path)
HubProtocolVersionTests.cs (7)
37
public async Task ClientUsingOldCallWithOriginalProtocol(
HttpTransportType
transportType)
69
public async Task ClientUsingOldCallWithNewProtocol(
HttpTransportType
transportType)
102
public async Task ClientUsingNewCallWithNewProtocol(
HttpTransportType
transportType)
163
public async Task ClientWithUnsupportedProtocolVersionDoesNotConnect(
HttpTransportType
transportType)
253
yield return new object[] {
HttpTransportType
.WebSockets };
255
yield return new object[] {
HttpTransportType
.ServerSentEvents };
256
yield return new object[] {
HttpTransportType
.LongPolling };
Startup.cs (2)
105
endpoints.MapHub<TestHub>("/default-nowebsockets", options => options.Transports =
HttpTransportType
.LongPolling |
HttpTransportType
.ServerSentEvents);
Microsoft.AspNetCore.SignalR.Client.Tests (44)
HttpConnectionFactoryTests.cs (1)
91
{ $"{nameof(HttpConnectionOptions.Transports)}",
HttpTransportType
.ServerSentEvents },
HttpConnectionTests.ConnectionLifecycle.cs (2)
501
CreateConnection(httpHandler, loggerFactory: LoggerFactory, transport: sse, transportType:
HttpTransportType
.ServerSentEvents),
527
CreateConnection(httpHandler, transport: lp, transportType:
HttpTransportType
.LongPolling),
HttpConnectionTests.cs (2)
99
httpOptions.Transports =
HttpTransportType
.LongPolling;
183
Transports =
HttpTransportType
.WebSockets,
HttpConnectionTests.Helpers.cs (2)
25
HttpTransportType
? transportType = null,
31
Transports = transportType ??
HttpTransportType
.LongPolling,
HttpConnectionTests.Negotiate.cs (4)
49
return RunInvalidNegotiateResponseTest<AggregateException>(ResponseUtils.CreateNegotiationContent(transportTypes:
HttpTransportType
.ServerSentEvents),
56
return RunInvalidNegotiateResponseTest<NoTransportSupportedException>(ResponseUtils.CreateNegotiationContent(transportTypes:
HttpTransportType
.None), "None of the transports supported by the client are supported by the server.");
514
transportFactory.Setup(t => t.CreateTransport(
HttpTransportType
.LongPolling, false))
563
transportFactory.Setup(t => t.CreateTransport(
HttpTransportType
.LongPolling, false))
HttpConnectionTests.Transport.cs (17)
29
[InlineData(
HttpTransportType
.LongPolling)]
30
[InlineData(
HttpTransportType
.ServerSentEvents)]
31
public async Task HttpConnectionSetsAccessTokenOnAllRequests(
HttpTransportType
transportType)
79
[InlineData(
HttpTransportType
.LongPolling, true)]
80
[InlineData(
HttpTransportType
.ServerSentEvents, false)]
81
public async Task HttpConnectionSetsInherentKeepAliveFeature(
HttpTransportType
transportType, bool expectedValue)
105
[InlineData(
HttpTransportType
.LongPolling)]
106
[InlineData(
HttpTransportType
.ServerSentEvents)]
107
public async Task HttpConnectionSetsUserAgentOnAllRequests(
HttpTransportType
transportType)
153
[InlineData(
HttpTransportType
.LongPolling)]
154
[InlineData(
HttpTransportType
.ServerSentEvents)]
155
public async Task HttpConnectionSetsRequestedWithOnAllRequests(
HttpTransportType
transportType)
335
CreateConnection(testHttpHandler, transportType:
HttpTransportType
.ServerSentEvents, accessTokenProvider: AccessTokenProvider),
405
CreateConnection(testHttpHandler, transportType:
HttpTransportType
.LongPolling, accessTokenProvider: AccessTokenProvider),
443
CreateConnection(testHttpHandler, transportType:
HttpTransportType
.LongPolling, accessTokenProvider: AccessTokenProvider),
503
CreateConnection(testHttpHandler, transportType:
HttpTransportType
.ServerSentEvents, accessTokenProvider: AccessTokenProvider),
546
CreateConnection(testHttpHandler, transportType:
HttpTransportType
.ServerSentEvents, accessTokenProvider: AccessTokenProvider),
HubConnectionBuilderExtensionsTests.cs (5)
36
connectionBuilder.WithUrl("http://tempuri.org",
HttpTransportType
.LongPolling);
42
Assert.Equal(
HttpTransportType
.LongPolling, value.Transports);
50
connectionBuilder.WithUrl(uri,
HttpTransportType
.LongPolling);
56
Assert.Equal(
HttpTransportType
.LongPolling, value.Transports);
66
connectionBuilder.WithUrl(uri,
HttpTransportType
.LongPolling, options => { options.Proxy = proxy; });
HubConnectionTests.cs (1)
768
.WithUrl("http://example.com", Http.Connections.
HttpTransportType
.WebSockets,
ResponseUtils.cs (7)
65
HttpTransportType
? transportTypes = null, string connectionToken = "connection-token", int negotiateVersion = 0)
70
if ((transportTypes &
HttpTransportType
.WebSockets) != 0)
74
transport = nameof(
HttpTransportType
.WebSockets),
78
if ((transportTypes &
HttpTransportType
.ServerSentEvents) != 0)
82
transport = nameof(
HttpTransportType
.ServerSentEvents),
86
if ((transportTypes &
HttpTransportType
.LongPolling) != 0)
90
transport = nameof(
HttpTransportType
.LongPolling),
TestServerTests.cs (2)
41
options.Transports = Http.Connections.
HttpTransportType
.WebSockets;
92
options.Transports = Http.Connections.
HttpTransportType
.LongPolling;
TestTransportFactory.cs (1)
18
public ITransport CreateTransport(
HttpTransportType
availableServerTransports, bool useStatefulReconnect)
Microsoft.AspNetCore.SignalR.StackExchangeRedis.Tests (13)
RedisEndToEnd.cs (13)
40
public async Task HubConnectionCanSendAndReceiveMessages(
HttpTransportType
transportType, string protocolName)
60
public async Task HubConnectionCanSendAndReceiveGroupMessages(
HttpTransportType
transportType, string protocolName)
93
public async Task CanSendAndReceiveUserMessagesFromMultipleConnectionsWithSameUser(
HttpTransportType
transportType, string protocolName)
122
public async Task CanSendAndReceiveUserMessagesWhenOneConnectionWithUserDisconnects(
HttpTransportType
transportType, string protocolName)
151
public async Task HubConnectionCanSendAndReceiveGroupMessagesGroupNameWithPatternIsTreatedAsLiteral(
HttpTransportType
transportType, string protocolName)
187
public async Task CanSendAndReceiveUserMessagesUserNameWithPatternIsTreatedAsLiteral(
HttpTransportType
transportType, string protocolName)
216
private static HubConnection CreateConnection(string url,
HttpTransportType
transportType, IHubProtocol protocol, ILoggerFactory loggerFactory, string userName = null)
233
private static IEnumerable<
HttpTransportType
> TransportTypes()
237
yield return
HttpTransportType
.WebSockets;
239
yield return
HttpTransportType
.ServerSentEvents;
240
yield return
HttpTransportType
.LongPolling;
247
foreach (
var
transport in TransportTypes())
251
if (transport !=
HttpTransportType
.ServerSentEvents)
Microsoft.AspNetCore.SignalR.Tests (52)
DefaultTransportFactoryTests.cs (28)
17
private const
HttpTransportType
AllTransportTypes =
HttpTransportType
.WebSockets |
HttpTransportType
.ServerSentEvents |
HttpTransportType
.LongPolling;
20
[InlineData(
HttpTransportType
.None)]
21
[InlineData((
HttpTransportType
)int.MaxValue)]
22
public void DefaultTransportFactoryCanBeCreatedWithNoOrUnknownTransportTypeFlags(
HttpTransportType
transportType)
29
[InlineData(
HttpTransportType
.LongPolling)]
30
[InlineData(
HttpTransportType
.ServerSentEvents)]
31
[InlineData(
HttpTransportType
.LongPolling |
HttpTransportType
.WebSockets)]
32
[InlineData(
HttpTransportType
.ServerSentEvents |
HttpTransportType
.WebSockets)]
33
public void DefaultTransportFactoryCannotBeCreatedWithoutHttpClient(
HttpTransportType
transportType)
44
new DefaultTransportFactory(
HttpTransportType
.WebSockets, new LoggerFactory(), httpClient: null, httpConnectionOptions: null, accessTokenProvider: null);
48
[InlineData(
HttpTransportType
.WebSockets, typeof(WebSocketsTransport))]
49
[InlineData(
HttpTransportType
.ServerSentEvents, typeof(ServerSentEventsTransport))]
50
[InlineData(
HttpTransportType
.LongPolling, typeof(LongPollingTransport))]
52
public void DefaultTransportFactoryCreatesRequestedTransportIfAvailable(
HttpTransportType
requestedTransport, Type expectedTransportType)
60
[InlineData(
HttpTransportType
.WebSockets)]
61
[InlineData(
HttpTransportType
.ServerSentEvents)]
62
[InlineData(
HttpTransportType
.LongPolling)]
64
public void DefaultTransportFactoryThrowsIfItCannotCreateRequestedTransport(
HttpTransportType
requestedTransport)
85
[InlineData(
HttpTransportType
.ServerSentEvents, typeof(ServerSentEventsTransport))]
86
[InlineData(
HttpTransportType
.LongPolling, typeof(LongPollingTransport))]
87
public void DefaultTransportFactoryCreatesRequestedTransportIfAvailable_Win7(
HttpTransportType
requestedTransport, Type expectedTransportType)
98
[InlineData(
HttpTransportType
.WebSockets)]
99
public void DefaultTransportFactoryThrowsIfItCannotCreateRequestedTransport_Win7(
HttpTransportType
requestedTransport)
EndToEndTests.cs (24)
75
public async Task CanStartAndStopConnectionUsingGivenTransport(
HttpTransportType
transportType)
181
Transports =
HttpTransportType
.WebSockets,
213
[InlineData(
HttpTransportType
.LongPolling)]
214
[InlineData(
HttpTransportType
.ServerSentEvents)]
215
public async Task HttpConnectionThrowsIfSkipNegotiationSetAndTransportIsNotWebSockets(
HttpTransportType
transportType)
258
public async Task ConnectionCanSendAndReceiveMessages(
HttpTransportType
transportType, TransferFormat requestedTransferFormat)
323
var connection = new HttpConnection(new Uri(url),
HttpTransportType
.WebSockets, LoggerFactory);
387
var connection = new HttpConnection(new Uri(url),
HttpTransportType
.WebSockets, LoggerFactory);
414
Transports =
HttpTransportType
.WebSockets,
425
[InlineData(
HttpTransportType
.LongPolling)]
426
[InlineData(
HttpTransportType
.ServerSentEvents)]
428
public async Task UnauthorizedConnectionDoesNotConnect(
HttpTransportType
transportType)
491
Transports =
HttpTransportType
.ServerSentEvents,
517
await ServerClosesConnectionWithErrorIfHubCannotBeCreated(
HttpTransportType
.WebSockets);
531
await ServerClosesConnectionWithErrorIfHubCannotBeCreated(
HttpTransportType
.LongPolling);
540
private async Task ServerClosesConnectionWithErrorIfHubCannotBeCreated(
HttpTransportType
transportType)
614
.WithUrl(url,
HttpTransportType
.LongPolling)
662
.WithUrl(url,
HttpTransportType
.LongPolling, o =>
688
public ITransport CreateTransport(
HttpTransportType
availableServerTransports, bool useStatefulReconnect)
762
yield return new object[] {
HttpTransportType
.WebSockets };
764
yield return new object[] {
HttpTransportType
.ServerSentEvents };
765
yield return new object[] {
HttpTransportType
.LongPolling };
777
if ((
HttpTransportType
)transport[0] !=
HttpTransportType
.ServerSentEvents)
SignalR.Client.FunctionalTestApp (2)
Startup.cs (2)
235
endpoints.MapHub<TestHub>("/testhub-nowebsockets", options => options.Transports =
HttpTransportType
.ServerSentEvents |
HttpTransportType
.LongPolling);