/// <summary>
        /// Changes the interval after which clients will attempt to reestablish failed connections.
        /// </summary>
        /// <param name="reconnectInterval">The reconnect interval.</param>
        /// <param name="cancellationToken">The cancellation token to cancel operation.</param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task ChangeReconnectIntervalAsync(uint reconnectInterval, CancellationToken cancellationToken)
        {
            ReconnectInterval = reconnectInterval;

            ServerSentEventBytes reconnectIntervalBytes = ServerSentEventsHelper.GetReconnectIntervalBytes(reconnectInterval);

            return(SendAsync(reconnectIntervalBytes, cancellationToken));
        }
Beispiel #2
0
        /// <summary>
        /// Changes the interval after which clients will attempt to reestablish failed connections.
        /// </summary>
        /// <param name="reconnectInterval">The reconnect interval.</param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public Task ChangeReconnectIntervalAsync(uint reconnectInterval)
        {
            ReconnectInterval = reconnectInterval;

            ServerSentEventBytes reconnectIntervalBytes = ServerSentEventsHelper.GetReconnectIntervalBytes(reconnectInterval);

            return(ForAllClientsAsync(client => client.SendAsync(reconnectIntervalBytes)));
        }
 /// <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));
 }
 /// <summary>
 /// Sends event to all clients.
 /// </summary>
 /// <param name="text">The simple text 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 text, CancellationToken cancellationToken)
 {
     return(SendAsync(ServerSentEventsHelper.GetEventBytes(text), cancellationToken));
 }
 /// <summary>
 /// Sends event to clients in group.
 /// </summary>
 /// <param name="groupName">The group name.</param>
 /// <param name="text">The simple text event.</param>
 /// <returns>The task object representing the asynchronous operation.</returns>
 public Task SendEventAsync(string groupName, string text)
 {
     return(SendAsync(groupName, ServerSentEventsHelper.GetEventBytes(text), CancellationToken.None));
 }
Beispiel #9
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)));
 }
Beispiel #10
0
 /// <summary>
 /// Sends event to all clients.
 /// </summary>
 /// <param name="text">The simple text event.</param>
 /// <returns>The task object representing the asynchronous operation.</returns>
 public Task SendEventAsync(string text)
 {
     return(SendEventAsync(ServerSentEventsHelper.GetEventBytes(text)));
 }