Class PairingListener
- Namespace
- RustPlusApi.Fcm.Registration
- Assembly
- RustPlusApi.Fcm.Registration.dll
Step 8 convenience: wraps RustPlusFcm and surfaces the first in-game
"Pair with Server" notification as a strongly-typed ServerPairing, so the
whole pairing flow is one await.
public sealed class PairingListener : IDisposable
- Inheritance
-
PairingListener
- Implements
- Inherited Members
Remarks
The event surface (Listening, Paired, Stopped,
Failed) is modelled on Pronwan/rustplus-desktop's IPairingListener so
it can drop in as a replacement for that project's Node-process listener.
Constructors
PairingListener(Credentials, ICollection<string>?)
Step 8 convenience: wraps RustPlusFcm and surfaces the first in-game
"Pair with Server" notification as a strongly-typed ServerPairing, so the
whole pairing flow is one await.
public PairingListener(Credentials credentials, ICollection<string>? persistentIds = null)
Parameters
credentialsCredentialsFCM credentials used to connect and authenticate.
persistentIdsICollection<string>Already-seen message IDs the FCM listener should skip on reconnect.
Remarks
The event surface (Listening, Paired, Stopped,
Failed) is modelled on Pronwan/rustplus-desktop's IPairingListener so
it can drop in as a replacement for that project's Node-process listener.
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
WaitForServerPairingAsync(CancellationToken)
Connects, then completes with the first server-pairing notification received.
[ExcludeFromCodeCoverage]
public Task<ServerPairing> WaitForServerPairingAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenToken to cancel the wait.
Returns
Remarks
Excluded from coverage: requires a live FCM connection to complete; the pairing-notification mapping (ToServerPairing(Notification<ServerEvent>)) is unit-tested independently.
Events
Failed
Raised when the listener fails.
public event EventHandler<Exception>? Failed
Event Type
Listening
Raised once the listener is connected and waiting for pairing notifications.
public event EventHandler? Listening
Event Type
Paired
Raised when a server-pairing notification arrives.
public event EventHandler<ServerPairing>? Paired
Event Type
Stopped
Raised when the listener stops.
public event EventHandler? Stopped