C# Class IronPigeon.Channel

A channel for sending or receiving secure messages.
Mostrar archivo Open project: AArnott/IronPigeon Class Usage Examples

Public Methods

Method Description
Channel ( ) : System

Initializes a new instance of the Channel class.

Channel ( ICloudBlobStorageProvider cloudBlobStorage, HttpClient httpClient, HttpClient httpClientLongPoll, IEnumerable addressBooks ) : System

Initializes a new instance of the Channel class.

DeleteInboxItemAsync ( IronPigeon.Payload payload, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Deletes the online inbox item that points to a previously downloaded payload.

This method should be called after the client application has saved the downloaded payload to persistent storage.

DownloadPayloadAsync ( PayloadReference notification, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Downloads the message payload referred to by the specified PayloadReference.

GetVerifiableIdentifiersAsync ( IronPigeon.Endpoint endpoint, CancellationToken cancellationToken = default(CancellationToken) ) : Task>

Gets the set of identifiers this endpoint claims that are verifiable.

PostAsync ( IronPigeon.Payload message, IReadOnlyCollection recipients, System.DateTime expiresUtc, IProgress bytesCopiedProgress = null, CancellationToken cancellationToken = default(CancellationToken) ) : Task>

Sends some payload to a set of recipients.

PostPayloadAsync ( IronPigeon.Payload message, System.DateTime expiresUtc, IProgress bytesCopiedProgress = null, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Encrypts a message and uploads it to the cloud.

ReceiveAsync ( bool longPoll = false, IProgress progress = null, CancellationToken cancellationToken = default(CancellationToken) ) : Task>

Downloads messages from the server.

RegisterApplePushNotificationAsync ( string deviceToken, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Registers an iOS application to receive push notifications for incoming messages.

RegisterGooglePlayPushNotificationAsync ( string googlePlayRegistrationId, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Registers an Android application to receive push notifications for incoming messages.

RegisterWinPhonePushNotificationAsync ( Uri pushNotificationChannelUri, string pushContent = null, string toastLine1 = null, string toastLine2 = null, string tileTemplate = null, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Registers a Windows 8 application to receive push notifications for incoming messages.

RegisterWindowsPushNotificationChannelAsync ( string packageSecurityIdentifier, Uri pushNotificationChannelUri, System.DateTime channelExpiration, string pushContent, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Registers a Windows 8 application to receive push notifications for incoming messages.

Protected Methods

Method Description
DownloadPayloadReferenceAsync ( IncomingList inboxItem, CancellationToken cancellationToken ) : Task

Downloads a PayloadReference that is referenced from an incoming inbox item.

PostPayloadReferenceAsync ( PayloadReference messageReference, IReadOnlyCollection recipients, CancellationToken cancellationToken = default(CancellationToken) ) : Task>

Shares the reference to a message payload with the specified set of recipients.

PostPayloadReferenceAsync ( PayloadReference messageReference, IronPigeon.Endpoint recipient, CancellationToken cancellationToken ) : Task

Shares the reference to a message payload with the specified recipient.

Private Methods

Method Description
DeletePayloadReferenceAsync ( Uri payloadReferenceLocation, CancellationToken cancellationToken ) : Task

Deletes an entry from an inbox's incoming item list.

DownloadIncomingItemsAsync ( bool longPoll, CancellationToken cancellationToken ) : Task>

Downloads inbox items from the server.

IsVerifiableIdentifierAsync ( IronPigeon.Endpoint claimingEndpoint, string claimedIdentifier, CancellationToken cancellationToken = default(CancellationToken) ) : Task

Checks whether the specified identifier yields an endpoint equivalent to this one.

Log ( string caption, byte buffer ) : void

Logs a message.

Method Details

Channel() public method

Initializes a new instance of the Channel class.
public Channel ( ) : System
return System

Channel() public method

Initializes a new instance of the Channel class.
public Channel ( ICloudBlobStorageProvider cloudBlobStorage, HttpClient httpClient, HttpClient httpClientLongPoll, IEnumerable addressBooks ) : System
cloudBlobStorage ICloudBlobStorageProvider The cloud blob storage.
httpClient System.Net.Http.HttpClient The HTTP client.
httpClientLongPoll System.Net.Http.HttpClient The HTTP client long poll.
addressBooks IEnumerable The address books.
return System

DeleteInboxItemAsync() public method

Deletes the online inbox item that points to a previously downloaded payload.
This method should be called after the client application has saved the downloaded payload to persistent storage.
public DeleteInboxItemAsync ( IronPigeon.Payload payload, CancellationToken cancellationToken = default(CancellationToken) ) : Task
payload IronPigeon.Payload The payload whose originating inbox item should be deleted.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task

DownloadPayloadAsync() public method

Downloads the message payload referred to by the specified PayloadReference.
public DownloadPayloadAsync ( PayloadReference notification, CancellationToken cancellationToken = default(CancellationToken) ) : Task
notification PayloadReference The payload reference.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task

DownloadPayloadReferenceAsync() protected method

Downloads a PayloadReference that is referenced from an incoming inbox item.
protected DownloadPayloadReferenceAsync ( IncomingList inboxItem, CancellationToken cancellationToken ) : Task
inboxItem IncomingList The inbox item that referenced the .
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task

GetVerifiableIdentifiersAsync() public method

Gets the set of identifiers this endpoint claims that are verifiable.
public GetVerifiableIdentifiersAsync ( IronPigeon.Endpoint endpoint, CancellationToken cancellationToken = default(CancellationToken) ) : Task>
endpoint IronPigeon.Endpoint The endpoint whose authorized identifiers are to be verified.
cancellationToken System.Threading.CancellationToken A general cancellation token on the request.
return Task>

PostAsync() public method

Sends some payload to a set of recipients.
public PostAsync ( IronPigeon.Payload message, IReadOnlyCollection recipients, System.DateTime expiresUtc, IProgress bytesCopiedProgress = null, CancellationToken cancellationToken = default(CancellationToken) ) : Task>
message IronPigeon.Payload The payload to transmit.
recipients IReadOnlyCollection The recipients to receive the message.
expiresUtc System.DateTime The date after which the message may be destroyed.
bytesCopiedProgress IProgress Progress in terms of bytes copied.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task>

PostPayloadAsync() public method

Encrypts a message and uploads it to the cloud.
public PostPayloadAsync ( IronPigeon.Payload message, System.DateTime expiresUtc, IProgress bytesCopiedProgress = null, CancellationToken cancellationToken = default(CancellationToken) ) : Task
message IronPigeon.Payload The message being transmitted.
expiresUtc System.DateTime The date after which the message may be destroyed.
bytesCopiedProgress IProgress Receives progress in terms of number of bytes uploaded.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task

PostPayloadReferenceAsync() protected method

Shares the reference to a message payload with the specified set of recipients.
protected PostPayloadReferenceAsync ( PayloadReference messageReference, IReadOnlyCollection recipients, CancellationToken cancellationToken = default(CancellationToken) ) : Task>
messageReference PayloadReference The payload reference to share.
recipients IReadOnlyCollection The set of recipients that should be notified of the message.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task>

PostPayloadReferenceAsync() protected method

Shares the reference to a message payload with the specified recipient.
protected PostPayloadReferenceAsync ( PayloadReference messageReference, IronPigeon.Endpoint recipient, CancellationToken cancellationToken ) : Task
messageReference PayloadReference The payload reference to share.
recipient IronPigeon.Endpoint The recipient that should be notified of the message.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task

ReceiveAsync() public method

Downloads messages from the server.
Thrown when a connection to the server could not be established, or was terminated.
public ReceiveAsync ( bool longPoll = false, IProgress progress = null, CancellationToken cancellationToken = default(CancellationToken) ) : Task>
longPoll bool true to asynchronously wait for messages if there are none immediately available for download.
progress IProgress A callback that receives messages as they are retrieved.
cancellationToken System.Threading.CancellationToken A token whose cancellation signals lost interest in the result of this method.
return Task>

RegisterApplePushNotificationAsync() public method

Registers an iOS application to receive push notifications for incoming messages.
public RegisterApplePushNotificationAsync ( string deviceToken, CancellationToken cancellationToken = default(CancellationToken) ) : Task
deviceToken string The Apple-assigned device token to use from the cloud to reach this device.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task

RegisterGooglePlayPushNotificationAsync() public method

Registers an Android application to receive push notifications for incoming messages.
public RegisterGooglePlayPushNotificationAsync ( string googlePlayRegistrationId, CancellationToken cancellationToken = default(CancellationToken) ) : Task
googlePlayRegistrationId string The Google Cloud Messaging registration identifier.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task

RegisterWinPhonePushNotificationAsync() public method

Registers a Windows 8 application to receive push notifications for incoming messages.
public RegisterWinPhonePushNotificationAsync ( Uri pushNotificationChannelUri, string pushContent = null, string toastLine1 = null, string toastLine2 = null, string tileTemplate = null, CancellationToken cancellationToken = default(CancellationToken) ) : Task
pushNotificationChannelUri System.Uri The push notification channel's ChannelUri property.
pushContent string Content of the push.
toastLine1 string The first line in the toast notification to send.
toastLine2 string The second line in the toast notification to send.
tileTemplate string The tile template used by the client app.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task

RegisterWindowsPushNotificationChannelAsync() public method

Registers a Windows 8 application to receive push notifications for incoming messages.
public RegisterWindowsPushNotificationChannelAsync ( string packageSecurityIdentifier, Uri pushNotificationChannelUri, System.DateTime channelExpiration, string pushContent, CancellationToken cancellationToken = default(CancellationToken) ) : Task
packageSecurityIdentifier string The package security identifier of the app.
pushNotificationChannelUri System.Uri The push notification channel.
channelExpiration System.DateTime When the channel will expire.
pushContent string Content of the push.
cancellationToken System.Threading.CancellationToken The cancellation token.
return Task