Class FcmRegistration
- Namespace
- RustPlusApi.Fcm.Registration
- Assembly
- RustPlusApi.Fcm.Registration.dll
Orchestrates the native credential acquisition flow, replacing the Node CLI.
public sealed class FcmRegistration
- Inheritance
-
FcmRegistration
- Inherited Members
Remarks
Every network step hits live Google / Expo / Facepunch services and is upstream-fragile; it cannot be validated offline. See RegistrationConstants.
Constructors
FcmRegistration(HttpClient?, int)
Orchestrates the native credential acquisition flow, replacing the Node CLI.
public FcmRegistration(HttpClient? httpClient = null, int steamLoginPort = 3000)
Parameters
httpClientHttpClientOptional HttpClient to use for all HTTP requests; a new instance is created if null.
steamLoginPortintThe loopback port the Steam login callback listener binds to.
Remarks
Every network step hits live Google / Expo / Facepunch services and is upstream-fragile; it cannot be validated offline. See RegistrationConstants.
Methods
AcquireCredentialsAsync(CancellationToken)
Steps 1–4: GCM check-in, Firebase install, FCM register and Expo token. Returns the Credentials the FCM listener needs (GCM identity + FCM + Expo tokens).
public Task<Credentials> AcquireCredentialsAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
RegisterWithRustPlusAsync(Credentials, Action<string>?, CancellationToken)
Steps 5–6: interactive Steam login, then register the device's Expo token with Rust Companion so it receives pairing pushes. Returns the captured Steam identity.
[ExcludeFromCodeCoverage]
public Task<SteamLoginResult> RegisterWithRustPlusAsync(Credentials credentials, Action<string>? onLoginUrl = null, CancellationToken cancellationToken = default)
Parameters
credentialsCredentialsCredentials obtained from AcquireCredentialsAsync(CancellationToken).
onLoginUrlAction<string>Invoked with the Steam login URL before the browser is opened, so callers can print it — the flow still completes on a headless host if the user opens it by hand.
cancellationTokenCancellationTokenToken to cancel the operation.
Returns
Remarks
Excluded from coverage: post-guard flow drives live Steam login and Companion registration; the guard (missing ExpoPushToken) is unit-tested, the remainder is only validatable by a real run against the live endpoints.
Exceptions
- InvalidOperationException
Thrown when
credentialsis missing the Expo push token.