Show / Hide Table of Contents

Class PushServiceClient

A Web Push Protocol compliant client for push service.

Inheritance
System.Object
PushServiceClient
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Lib.Net.Http.WebPush
Assembly: Lib.Net.Http.WebPush.dll
Syntax
public class PushServiceClient
Remarks

The PushServiceClient should be considered an expensive object as it internally holds an instance of System.Net.Http.HttpClient class. In order to avoid Improper Instantiation antipattern a shared singleton instance should be created or a pool of reusable instances should be used.

Constructors

PushServiceClient()

Creates new instance of PushServiceClient class.

Declaration
public PushServiceClient()

PushServiceClient(HttpClient)

Creates new instance of PushServiceClient class.

Declaration
public PushServiceClient(HttpClient httpClient)
Parameters
Type Name Description
System.Net.Http.HttpClient httpClient

The HttpClient instance.

Properties

AutoRetryAfter

Gets or sets the value indicating if client should automatically attempt to retry in case of 429 Too Many Requests.

Declaration
public bool AutoRetryAfter { get; set; }
Property Value
Type Description
System.Boolean

DefaultAuthentication

Gets or sets the default authentication details.

Declaration
public VapidAuthentication DefaultAuthentication { get; set; }
Property Value
Type Description
VapidAuthentication

DefaultAuthenticationScheme

Gets or sets the default VapidAuthenticationScheme to be used.

Declaration
public VapidAuthenticationScheme DefaultAuthenticationScheme { get; set; }
Property Value
Type Description
VapidAuthenticationScheme

DefaultTimeToLive

Gets or sets the default time (in seconds) for which the message should be retained by push service. It will be used when TimeToLive is not set.

Declaration
public int DefaultTimeToLive { get; set; }
Property Value
Type Description
System.Int32

MaxRetriesAfter

Gets or sets the value indicating the maximum number of automatic attempts to retry in case of 429 Too Many Requests (<= 0 means unlimited).

Declaration
public int MaxRetriesAfter { get; set; }
Property Value
Type Description
System.Int32

Methods

RequestPushMessageDeliveryAsync(PushSubscription, PushMessage)

Requests delivery of push message by push service as an asynchronous operation.

Declaration
public Task RequestPushMessageDeliveryAsync(PushSubscription subscription, PushMessage message)
Parameters
Type Name Description
PushSubscription subscription

The push service subscription.

PushMessage message

The push message.

Returns
Type Description
System.Threading.Tasks.Task

The task object representing the asynchronous operation.

RequestPushMessageDeliveryAsync(PushSubscription, PushMessage, VapidAuthentication)

Requests delivery of push message by push service as an asynchronous operation.

Declaration
public Task RequestPushMessageDeliveryAsync(PushSubscription subscription, PushMessage message, VapidAuthentication authentication)
Parameters
Type Name Description
PushSubscription subscription

The push service subscription.

PushMessage message

The push message.

VapidAuthentication authentication

The authentication details.

Returns
Type Description
System.Threading.Tasks.Task

The task object representing the asynchronous operation.

RequestPushMessageDeliveryAsync(PushSubscription, PushMessage, VapidAuthentication, VapidAuthenticationScheme)

Requests delivery of push message by push service as an asynchronous operation.

Declaration
public Task RequestPushMessageDeliveryAsync(PushSubscription subscription, PushMessage message, VapidAuthentication authentication, VapidAuthenticationScheme authenticationScheme)
Parameters
Type Name Description
PushSubscription subscription

The push service subscription.

PushMessage message

The push message.

VapidAuthentication authentication

The authentication details.

VapidAuthenticationScheme authenticationScheme

The VapidAuthenticationScheme to use.

Returns
Type Description
System.Threading.Tasks.Task

The task object representing the asynchronous operation.

RequestPushMessageDeliveryAsync(PushSubscription, PushMessage, VapidAuthentication, VapidAuthenticationScheme, CancellationToken)

Requests delivery of push message by push service as an asynchronous operation.

Declaration
public async Task RequestPushMessageDeliveryAsync(PushSubscription subscription, PushMessage message, VapidAuthentication authentication, VapidAuthenticationScheme authenticationScheme, CancellationToken cancellationToken)
Parameters
Type Name Description
PushSubscription subscription

The push service subscription.

PushMessage message

The push message.

VapidAuthentication authentication

The authentication details.

VapidAuthenticationScheme authenticationScheme

The VapidAuthenticationScheme to use.

System.Threading.CancellationToken cancellationToken

The cancellation token to cancel operation.

Returns
Type Description
System.Threading.Tasks.Task

The task object representing the asynchronous operation.

RequestPushMessageDeliveryAsync(PushSubscription, PushMessage, VapidAuthentication, CancellationToken)

Requests delivery of push message by push service as an asynchronous operation.

Declaration
public Task RequestPushMessageDeliveryAsync(PushSubscription subscription, PushMessage message, VapidAuthentication authentication, CancellationToken cancellationToken)
Parameters
Type Name Description
PushSubscription subscription

The push service subscription.

PushMessage message

The push message.

VapidAuthentication authentication

The authentication details.

System.Threading.CancellationToken cancellationToken

The cancellation token to cancel operation.

Returns
Type Description
System.Threading.Tasks.Task

The task object representing the asynchronous operation.

RequestPushMessageDeliveryAsync(PushSubscription, PushMessage, CancellationToken)

Requests delivery of push message by push service as an asynchronous operation.

Declaration
public Task RequestPushMessageDeliveryAsync(PushSubscription subscription, PushMessage message, CancellationToken cancellationToken)
Parameters
Type Name Description
PushSubscription subscription

The push service subscription.

PushMessage message

The push message.

System.Threading.CancellationToken cancellationToken

The cancellation token to cancel operation.

Returns
Type Description
System.Threading.Tasks.Task

The task object representing the asynchronous operation.

Back to top Copyright © 2018 - 2024 Tomasz Pęczek