Table of Contents

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

credentials Credentials

The Credentials used for authentication.

persistentIds ICollection<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.

options RustPlusFcmSocketOptions

Tuning options (heartbeat interval, inactivity timeout); defaults are used when null.

loggerFactory ILoggerFactory

Routes 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

message FcmMessage

The 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

EventHandler<AlarmNotification>

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

EventHandler<Notification<EntityEvent>>

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

EventHandler<FcmMessage>

OnServerPairing

Occurs when a server pairing notification is received.

public event EventHandler<Notification<ServerEvent?>>? OnServerPairing

Event Type

EventHandler<Notification<ServerEvent>>

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

EventHandler<Notification<ulong?>>

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

EventHandler<Notification<ulong?>>

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

EventHandler<Notification<ulong?>>

Remarks

The event data is a Notification<T> containing a ulong entity ID.