/// <summary>
 /// Sends event to clients in group.
 /// </summary>
 /// <param name="groupName">The group name.</param>
 /// <param name="serverSentEvent">The event.</param>
 /// <param name="clientPredicate">The function to test each client for a condition.</param>
 /// <param name="cancellationToken">The cancellation token to cancel operation.</param>
 /// <returns>The task object representing the asynchronous operation.</returns>
 public Task SendEventAsync(string groupName, ServerSentEvent serverSentEvent, Func <IServerSentEventsClient, bool> clientPredicate, CancellationToken cancellationToken)
 {
     return(SendAsync(groupName, ServerSentEventsHelper.GetEventBytes(serverSentEvent), clientPredicate, cancellationToken));
 }
 /// <summary>
 /// Sends event to clients in group.
 /// </summary>
 /// <param name="groupName">The group name.</param>
 /// <param name="serverSentEvent">The event.</param>
 /// <param name="cancellationToken">The cancellation token to cancel operation.</param>
 /// <returns>The task object representing the asynchronous operation.</returns>
 public Task SendEventAsync(string groupName, ServerSentEvent serverSentEvent, CancellationToken cancellationToken)
 {
     return(SendAsync(groupName, ServerSentEventsHelper.GetEventBytes(serverSentEvent), cancellationToken));
 }
 /// <summary>
 /// Sends event to all clients.
 /// </summary>
 /// <param name="serverSentEvent">The event.</param>
 /// <param name="clientPredicate">The function to test each client for a condition.</param>
 /// <returns>The task object representing the asynchronous operation.</returns>
 public Task SendEventAsync(ServerSentEvent serverSentEvent, Func <IServerSentEventsClient, bool> clientPredicate)
 {
     return(SendAsync(ServerSentEventsHelper.GetEventBytes(serverSentEvent), clientPredicate, CancellationToken.None));
 }
 /// <summary>
 /// Sends event to all clients.
 /// </summary>
 /// <param name="serverSentEvent">The event.</param>
 /// <returns>The task object representing the asynchronous operation.</returns>
 public Task SendEventAsync(ServerSentEvent serverSentEvent)
 {
     return(SendAsync(ServerSentEventsHelper.GetEventBytes(serverSentEvent), CancellationToken.None));
 }
Exemplo n.º 5
0
 /// <summary>
 /// Sends event to all clients.
 /// </summary>
 /// <param name="serverSentEvent">The event.</param>
 /// <returns>The task object representing the asynchronous operation.</returns>
 public Task SendEventAsync(ServerSentEvent serverSentEvent)
 {
     return(SendEventAsync(ServerSentEventsHelper.GetEventBytes(serverSentEvent)));
 }
        /// <summary>
        /// Sends event to all clients.
        /// </summary>
        /// <param name="serverSentEvent">The event.</param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task SendEventAsync(ServerSentEvent serverSentEvent)
        {
            RawServerSentEvent rawServerSentEvent = new RawServerSentEvent(serverSentEvent);

            return(ForAllClientsAsync(client => client.SendEventAsync(rawServerSentEvent)));
        }