Skip to content

Commit 659532b

Browse files
BrennanConroyhalter73pranavkm
authored
API docs for SignalR (#26445)
* API docs for SignalR * Apply suggestions from code review Co-authored-by: Stephen Halter <halter73@gmail.com> Co-authored-by: Pranav K <prkrishn@hotmail.com> Co-authored-by: Stephen Halter <halter73@gmail.com> Co-authored-by: Pranav K <prkrishn@hotmail.com>
1 parent cd94cd6 commit 659532b

File tree

40 files changed

+354
-4
lines changed

40 files changed

+354
-4
lines changed

src/SignalR/clients/csharp/Client.Core/src/HubConnection.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,19 @@ namespace Microsoft.AspNetCore.SignalR.Client
3535
/// </remarks>
3636
public partial class HubConnection : IAsyncDisposable
3737
{
38+
/// <summary>
39+
/// The default timeout which specifies how long to wait for a message before closing the connection. Default is 30 seconds.
40+
/// </summary>
3841
public static readonly TimeSpan DefaultServerTimeout = TimeSpan.FromSeconds(30); // Server ping rate is 15 sec, this is 2 times that.
42+
43+
/// <summary>
44+
/// The default timeout which specifies how long to wait for the handshake to respond before closing the connection. Default is 15 seconds.
45+
/// </summary>
3946
public static readonly TimeSpan DefaultHandshakeTimeout = TimeSpan.FromSeconds(15);
47+
48+
/// <summary>
49+
/// The default interval that the client will send keep alive messages to let the server know to not close the connection. Default is 15 second interval.
50+
/// </summary>
4051
public static readonly TimeSpan DefaultKeepAliveInterval = TimeSpan.FromSeconds(15);
4152

4253
// This lock protects the connection state.

src/SignalR/clients/csharp/Client.Core/src/HubConnectionBuilder.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ public override string ToString()
8080
}
8181

8282
// Prevents from being displayed in intellisense
83+
/// <summary>
84+
/// Gets the <see cref="Type"/> of the current instance.
85+
/// </summary>
8386
[EditorBrowsable(EditorBrowsableState.Never)]
8487
public new Type GetType()
8588
{

src/SignalR/clients/csharp/Client.Core/src/Microsoft.AspNetCore.SignalR.Client.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<Description>Client for ASP.NET Core SignalR</Description>
55
<TargetFrameworks>$(DefaultNetFxTargetFramework);netstandard2.0;netstandard2.1</TargetFrameworks>
66
<RootNamespace>Microsoft.AspNetCore.SignalR.Client</RootNamespace>
7+
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
78
</PropertyGroup>
89

910
<ItemGroup>

src/SignalR/clients/csharp/Client/src/Microsoft.AspNetCore.SignalR.Client.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<Description>Client for ASP.NET Core SignalR</Description>
55
<TargetFrameworks>$(DefaultNetFxTargetFramework);netstandard2.0</TargetFrameworks>
6+
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
67
</PropertyGroup>
78

89
<ItemGroup>

src/SignalR/clients/csharp/Http.Connections.Client/src/Microsoft.AspNetCore.Http.Connections.Client.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<Description>Client for ASP.NET Core Connection Handlers</Description>
55
<TargetFrameworks>$(DefaultNetFxTargetFramework);netstandard2.0;netstandard2.1</TargetFrameworks>
6+
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
67
</PropertyGroup>
78

89
<ItemGroup>

src/SignalR/clients/csharp/Http.Connections.Client/src/NoTransportSupportedException.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ namespace Microsoft.AspNetCore.Http.Connections.Client
1010
/// </summary>
1111
public class NoTransportSupportedException : Exception
1212
{
13+
/// <summary>
14+
/// Constructs the <see cref="NoTransportSupportedException"/> exception with the provided <paramref name="message"/>.
15+
/// </summary>
16+
/// <param name="message">Message of the exception.</param>
1317
public NoTransportSupportedException(string message)
1418
: base(message)
1519
{

src/SignalR/clients/csharp/Http.Connections.Client/src/TransportFailedException.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,17 @@ namespace Microsoft.AspNetCore.Http.Connections.Client
1010
/// </summary>
1111
public class TransportFailedException : Exception
1212
{
13+
/// <summary>
14+
/// The name of the transport that failed to connect.
15+
/// </summary>
1316
public string TransportType { get; }
1417

18+
/// <summary>
19+
/// Constructs a <see cref="TransportFailedException"/>.
20+
/// </summary>
21+
/// <param name="transportType">The name of the transport that failed to connect.</param>
22+
/// <param name="message">The reason the transport failed.</param>
23+
/// <param name="innerException">An optional extra exception if one was thrown while trying to connect.</param>
1524
public TransportFailedException(string transportType, string message, Exception innerException = null)
1625
: base($"{transportType} failed: {message}", innerException)
1726
{

src/SignalR/common/Http.Connections.Common/src/AvailableTransport.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,19 @@
55

66
namespace Microsoft.AspNetCore.Http.Connections
77
{
8+
/// <summary>
9+
/// Part of the <see cref="NegotiationResponse"/> that represents an individual transport and the trasfer formats the transport supports.
10+
/// </summary>
811
public class AvailableTransport
912
{
13+
/// <summary>
14+
/// A transport available on the server.
15+
/// </summary>
1016
public string Transport { get; set; }
17+
18+
/// <summary>
19+
/// A list of formats supported by the transport. Examples include "Text" and "Binary".
20+
/// </summary>
1121
public IList<string> TransferFormats { get; set; }
1222
}
1323
}

src/SignalR/common/Http.Connections.Common/src/Microsoft.AspNetCore.Http.Connections.Common.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<IsAspNetCoreApp>true</IsAspNetCoreApp>
88
<RootNamespace>Microsoft.AspNetCore.Http.Connections</RootNamespace>
99
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
10+
<NoWarn>$(NoWarn.Replace('1591', ''))</NoWarn>
1011
</PropertyGroup>
1112

1213
<ItemGroup>

src/SignalR/common/Http.Connections.Common/src/NegotiateProtocol.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
namespace Microsoft.AspNetCore.Http.Connections
1313
{
14+
/// <summary>
15+
/// The protocol for reading and writing negotiate requests and responses.
16+
/// </summary>
1417
public static class NegotiateProtocol
1518
{
1619
private const string ConnectionIdPropertyName = "connectionId";
@@ -36,6 +39,11 @@ public static class NegotiateProtocol
3639
// Used to detect ASP.NET SignalR Server connection attempt
3740
private static ReadOnlySpan<byte> ProtocolVersionPropertyNameBytes => new byte[] { (byte)'P', (byte)'r', (byte)'o', (byte)'t', (byte)'o', (byte)'c', (byte)'o', (byte)'l', (byte)'V', (byte)'e', (byte)'r', (byte)'s', (byte)'i', (byte)'o', (byte)'n' };
3841

42+
/// <summary>
43+
/// Writes the <paramref name="response"/> to the <paramref name="output"/>.
44+
/// </summary>
45+
/// <param name="response">The negotiation response generated in response to a negotiation request.</param>
46+
/// <param name="output">Where the <paramref name="response"/> is written to as Json.</param>
3947
public static void WriteResponse(NegotiationResponse response, IBufferWriter<byte> output)
4048
{
4149
var reusableWriter = ReusableUtf8JsonWriter.Get(output);
@@ -124,6 +132,11 @@ public static void WriteResponse(NegotiationResponse response, IBufferWriter<byt
124132
}
125133
}
126134

135+
/// <summary>
136+
/// Parses a <see cref="NegotiationResponse"/> from the <paramref name="content"/> as Json.
137+
/// </summary>
138+
/// <param name="content">The bytes of a Json payload that represents a <see cref="NegotiationResponse"/>.</param>
139+
/// <returns>The parsed <see cref="NegotiationResponse"/>.</returns>
127140
public static NegotiationResponse ParseResponse(ReadOnlySpan<byte> content)
128141
{
129142
try

0 commit comments

Comments
 (0)