Table of Contents

Interface IRustPlusFcmSocket

Namespace
RustPlusApi.Fcm.Interfaces
Assembly
RustPlusApi.Fcm.dll

Defines the connection lifecycle and notification events for a low-level FCM MCS socket. Clients are disposable; prefer DisposeAsync() so teardown drains background work.

public interface IRustPlusFcmSocket : IDisposable, IAsyncDisposable
Inherited Members

Methods

ConnectAsync(CancellationToken)

Connects to the FCM MCS endpoint and begins receiving notifications. On failure, ErrorOccurred is raised and the exception is rethrown. Instances are single-connection: after Disconnect() or disposal, create a new instance to reconnect.

Task ConnectAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to cancel the connection attempt.

Returns

Task

Exceptions

InvalidOperationException

Thrown when the socket is already connected or was closed.

Disconnect()

Cancels the receive loop and releases socket resources.

void Disconnect()

Events

Connected

Raised when the client has successfully connected and logged in.

event EventHandler? Connected

Event Type

EventHandler

Connecting

Raised when the client begins connecting to the FCM server.

event EventHandler? Connecting

Event Type

EventHandler

Disconnected

Raised when the client has fully disconnected.

event EventHandler? Disconnected

Event Type

EventHandler

Disconnecting

Raised when the client begins disconnecting.

event EventHandler? Disconnecting

Event Type

EventHandler

ErrorOccurred

Raised when an unhandled exception occurs on the receive loop.

event EventHandler<Exception>? ErrorOccurred

Event Type

EventHandler<Exception>

NotificationReceived

Raised when a raw FCM notification JSON string is received.

event EventHandler<string>? NotificationReceived

Event Type

EventHandler<string>

SocketClosed

Raised when the server sends a close tag.

event EventHandler? SocketClosed

Event Type

EventHandler