File tree Expand file tree Collapse file tree 3 files changed +28
-3
lines changed
Lib.AspNetCore.ServerSentEvents Expand file tree Collapse file tree 3 files changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ public interface IServerSentEventsService
5656 /// </summary>
5757 /// <param name="groupName">The group name.</param>
5858 /// <param name="client">The client to add to a group.</param>
59- Task AddToGroupAsync ( string groupName , IServerSentEventsClient client ) ;
59+ /// <returns>The task object representing the result of asynchronous operation</returns>
60+ Task < ServerSentEventsAddToGroupResult > AddToGroupAsync ( string groupName , IServerSentEventsClient client ) ;
6061
6162 /// <summary>
6263 /// Changes the interval after which clients will attempt to reestablish failed connections.
Original file line number Diff line number Diff line change 1+ namespace Lib . AspNetCore . ServerSentEvents
2+ {
3+ /// <summary>
4+ /// The add to group results.
5+ /// </summary>
6+ public enum ServerSentEventsAddToGroupResult
7+ {
8+ /// <summary>
9+ /// The client has been added to an existing group.
10+ /// </summary>
11+ AddedToExistingGroup = 1 ,
12+ /// <summary>
13+ /// The client has been added to a new group.
14+ /// </summary>
15+ AddedToNewGroup = 2
16+ }
17+ }
Original file line number Diff line number Diff line change @@ -114,15 +114,22 @@ public IReadOnlyCollection<IServerSentEventsClient> GetClients(string groupName)
114114 /// Adds a client to the specified group.
115115 /// </summary>
116116 /// <param name="groupName">The group name.</param>
117- /// <param name="client">The client to add to a group.</param>
118- public async Task AddToGroupAsync ( string groupName , IServerSentEventsClient client )
117+ /// /// <param name="client">The client to add to a group.</param>
118+ /// <returns>The task object representing the result of asynchronous operation</returns>
119+ public async Task < ServerSentEventsAddToGroupResult > AddToGroupAsync ( string groupName , IServerSentEventsClient client )
119120 {
121+ ServerSentEventsAddToGroupResult result = ServerSentEventsAddToGroupResult . AddedToExistingGroup ;
122+
120123 if ( ! _groups . ContainsKey ( groupName ) )
121124 {
122125 await CreateGroupAsync ( groupName ) ;
126+
127+ result = ServerSentEventsAddToGroupResult . AddedToNewGroup ;
123128 }
124129
125130 _groups [ groupName ] . TryAdd ( client . Id , client ) ;
131+
132+ return result ;
126133 }
127134
128135 /// <summary>
You can’t perform that action at this time.
0 commit comments