Class RustPlusFcm
- Namespace
- RustPlusApi.Fcm
- Assembly
- RustPlusApi.Fcm.dll
Represents a RustPlus FCM listener, which processes FCM notifications for RustPlus. Inherits from RustPlusFcmSocket.
public class RustPlusFcm : RustPlusFcmSocket, IRustPlusFcm, IRustPlusFcmSocket, IDisposable, IAsyncDisposable
- Inheritance
-
RustPlusFcm
- Implements
- Inherited Members
Constructors
RustPlusFcm(Credentials, ICollection<string>?, RustPlusFcmSocketOptions?, ILoggerFactory?)
Represents a RustPlus FCM listener, which processes FCM notifications for RustPlus. Inherits from RustPlusFcmSocket.
public RustPlusFcm(Credentials credentials, ICollection<string>? persistentIds = null, RustPlusFcmSocketOptions? options = null, ILoggerFactory? loggerFactory = null)
Parameters
credentialsCredentialsThe Credentials used for authentication.
persistentIdsICollection<string>Already-processed message ids, used for de-duplication, and the collection the socket harvests new ids into — pass a mutable, caller-owned set (prefer a HashSet<T>; a List<T> makes the duplicate check an O(n) scan). When null, de-duplication is disabled. The set is NOT cleared on login, so seeded ids survive reconnect. Read the current ids back via PersistentIds (snapshot) or subscribe to PersistentIdReceived (incremental) to persist them; ids have a server-side lifespan, so pruning your stored copy is your responsibility.
optionsRustPlusFcmSocketOptionsTuning options (heartbeat interval, inactivity timeout); defaults are used when null.
loggerFactoryILoggerFactoryRoutes the client's diagnostics into your logging stack; logging is disabled (a no-op
NullLogger) when null.
Methods
ParseNotification(FcmMessage)
Parses an incoming FcmMessage and dispatches events based on its channel.
protected override void ParseNotification(FcmMessage message)
Parameters
messageFcmMessageThe FcmMessage to parse.
Remarks
Invokes OnPairing, OnAlarmTriggered, and calls ParsePairing(Body, string) as appropriate.
Events
OnAlarmTriggered
Occurs when an alarm event is triggered.
public event EventHandler<AlarmNotification?>? OnAlarmTriggered
Event Type
Remarks
The event data is an AlarmNotification (server id + persistent id + title/message).
OnEntityPairing
Occurs when an entity pairing notification is received.
public event EventHandler<Notification<EntityEvent?>>? OnEntityPairing
Event Type
Remarks
The event data is a Notification<T> containing an EntityEvent.
OnPairing
Occurs when a pairing FcmMessage is received.
public event EventHandler<FcmMessage>? OnPairing
Event Type
OnServerPairing
Occurs when a server pairing notification is received.
public event EventHandler<Notification<ServerEvent?>>? OnServerPairing
Event Type
Remarks
The event data is a Notification<T> containing a ServerEvent.
OnSmartAlarmPairing
Occurs when a smart alarm pairing notification is received.
public event EventHandler<Notification<ulong?>>? OnSmartAlarmPairing
Event Type
Remarks
The event data is a Notification<T> containing a ulong entity ID.
OnSmartSwitchPairing
Occurs when a smart switch pairing notification is received.
public event EventHandler<Notification<ulong?>>? OnSmartSwitchPairing
Event Type
Remarks
The event data is a Notification<T> containing a ulong entity ID.
OnStorageMonitorPairing
Occurs when a storage monitor pairing notification is received.
public event EventHandler<Notification<ulong?>>? OnStorageMonitorPairing
Event Type
Remarks
The event data is a Notification<T> containing a ulong entity ID.