/// <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);
        }
 internal Task ChangeReconnectIntervalAsync(uint reconnectInterval)
 {
     return(SendAsync(ServerSentEventsHelper.GetReconnectIntervalBytes(reconnectInterval)));
 }
 /// <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));
 }
 internal Task <bool> ChangeReconnectIntervalAsync(uint reconnectInterval, CancellationToken cancellationToken)
 {
     return(SendAsync(ServerSentEventsHelper.GetReconnectIntervalBytes(reconnectInterval), cancellationToken));
 }
Ejemplo n.º 7
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));
 }