Skip to content

Commit 340f6fb

Browse files
committed
Improve code quality
1 parent 65c73e4 commit 340f6fb

File tree

5 files changed

+10
-18
lines changed

5 files changed

+10
-18
lines changed

Parse/Abstractions/Infrastructure/Execution/IWebSocketClient.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ public interface IWebSocketClient
4545
/// A token to observe cancellation requests. The operation will stop if the token is canceled.
4646
/// </param>
4747
/// <returns>A task that represents the asynchronous operation of sending the message.</returns>
48-
public Task SendAsync(string message, CancellationToken cancellationToken);
48+
/// <exception cref="InvalidOperationException">Thrown when trying to send a message on a WebSocket connection that is not in the Open state.</exception>
49+
public Task SendAsync(string message, CancellationToken cancellationToken = default);
4950
}

Parse/Infrastructure/Execution/TextWebSocketClient.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,12 @@ private void StartListening(CancellationToken cancellationToken)
135135
/// <returns>
136136
/// A task representing the asynchronous operation of sending the message to the WebSocket server.
137137
/// </returns>
138+
/// <exception cref="ArgumentNullException">Thrown when the WebSocket instance is null.</exception>
139+
/// <exception cref="WebSocketException">Thrown when there is an error during the WebSocket communication.</exception>
140+
/// <exception cref="InvalidOperationException">Thrown when trying to send a message on a WebSocket connection that is not in the Open state.</exception>
138141
public async Task SendAsync(string message, CancellationToken cancellationToken = default)
139142
{
140-
if (webSocket is not null && webSocket.State == WebSocketState.Open)
141-
{
142-
await webSocket.SendAsync(Encoding.UTF8.GetBytes(message), WebSocketMessageType.Text, true, cancellationToken);
143-
}
143+
ArgumentNullException.ThrowIfNull(webSocket);
144+
await webSocket.SendAsync(Encoding.UTF8.GetBytes(message), WebSocketMessageType.Text, true, cancellationToken);
144145
}
145146
}

Parse/Platform/LiveQueries/ParseLiveQueryDualEventArgs.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,5 @@ public class ParseLiveQueryDualEventArgs : ParseLiveQueryEventArgs
1515
/// </summary>
1616
public ParseObject Original { get; private set; }
1717

18-
/// <summary>
19-
/// Represents the event arguments provided to Live Query event handlers in the Parse platform.
20-
/// This class provides information about the current and original state of the Parse object
21-
/// involved in the Live Query operation.
22-
/// </summary>
2318
internal ParseLiveQueryDualEventArgs(ParseObject current, ParseObject original) : base(current) => Original = original;
2419
}

Parse/Platform/LiveQueries/ParseLiveQueryEventArgs.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,5 @@ public class ParseLiveQueryEventArgs : EventArgs
1717
/// </summary>
1818
public ParseObject Object { get; private set; }
1919

20-
/// <summary>
21-
/// Represents the event arguments provided to Live Query event handlers in the Parse platform.
22-
/// This class provides information about the current and original state of the Parse object
23-
/// involved in the Live Query operation.
24-
/// </summary>
2520
internal ParseLiveQueryEventArgs(ParseObject current) => Object = current;
2621
}

Parse/Platform/Queries/ParseQuery.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -913,10 +913,10 @@ public override int GetHashCode()
913913
}
914914

915915
/// <summary>
916-
/// Converts the current query into a live query that allows real-time updates to be monitored
917-
/// for changes that match the specified query criteria.
916+
/// Creates a live query from this query that can be used to receive real-time updates
917+
/// when objects matching the query are created, updated, or deleted.
918918
/// </summary>
919-
/// <returns>A ParseLiveQuery object configured to monitor changes for the query.</returns>
919+
/// <returns>A new ParseLiveQuery instace configured with this query's parameters.</returns>
920920
public ParseLiveQuery<T> GetLive()
921921
{
922922
ArgumentNullException.ThrowIfNull(Filters);

0 commit comments

Comments
 (0)