/// <summary>
        /// Sends event to client.
        /// </summary>
        /// <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 async Task <bool> SendEventAsync(ServerSentEvent serverSentEvent, CancellationToken cancellationToken)
        {
            bool success = await SendAsync(ServerSentEventsHelper.GetEventBytes(serverSentEvent), cancellationToken);

            if (success)
            {
                LastEventId = serverSentEvent.Id;
            }
            return(success);
        }
 /// <summary>
 /// Sends event to client.
 /// </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)));
 }
 /// <summary>
 /// Sends event to client.
 /// </summary>
 /// <param name="text">The simple text event.</param>
 /// <returns>The task object representing the asynchronous operation.</returns>
 public Task SendEventAsync(string text)
 {
     return(SendAsync(ServerSentEventsHelper.GetEventBytes(text)));
 }
 /// <summary>
 /// Sends event to client.
 /// </summary>
 /// <param name="text">The simple text event.</param>
 /// <returns>The task object representing the asynchronous operation.</returns>
 public Task <bool> SendEventAsync(string text)
 {
     return(SendAsync(ServerSentEventsHelper.GetEventBytes(text), CancellationToken.None));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Sends event to client.
 /// </summary>
 /// <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(ServerSentEvent serverSentEvent, CancellationToken cancellationToken)
 {
     return(SendAsync(ServerSentEventsHelper.GetEventBytes(serverSentEvent), cancellationToken));
 }