Method OpenAsync
- Namespace
- MailFathom.Application.Synchronization.Sessions
- Assembly
- MailFathom.Application.dll
OpenAsync(MailAccountId, MailFolderResolution, MailTransportSecurityPolicy, CancellationToken)
Opens a session that waits for changes to one folder, or reports that the server cannot serve one.
Task<MailboxNotificationSessionResult> OpenAsync(MailAccountId accountId, MailFolderResolution folder, MailTransportSecurityPolicy transportSecurityPolicy, CancellationToken cancellationToken)
Parameters
accountIdMailAccountIdThe local account identifier.
folderMailFolderResolutionThe alias binding whose remote path the session waits on, selected read-only.
transportSecurityPolicyMailTransportSecurityPolicyThe connection and authentication policy the implementation must obey.
cancellationTokenCancellationTokenCancels connecting, authenticating, and selecting the folder.
Returns
- Task<MailboxNotificationSessionResult>
An open session the caller owns and must dispose, or the statement that the server advertises no push mechanism.
Remarks
A server that advertises no push mechanism is an ordinary answer rather than a failure, because the caller polls instead and the account keeps synchronizing. It is reported as a result for that reason, and reported at all because an operator who configured push needs to see that the server declined it.
The capability is decided per open session rather than once per process. A server can gain or lose the mechanism across a restart or behind a load balancer, and a session that re-establishes itself asks again.
Exceptions
- ArgumentNullException
Thrown when
folderis null.- MailboxUnavailableException
Thrown when the mail server did not accept the session within its configured resilience budget.