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