Skip to content

PollingExtensions

Namespace: Signal.Bot

Full Name: Signal.Bot.PollingExtensions

Summary

Provides extension methods for ISignalBotClient to enable message polling and receiving functionality. These methods allow starting message receivers in various modes including fire-and-forget background tasks and controlled lifecycle management with disposable handles.

Methods

StartReceiving``1

csharp
StartReceiving``1(client, receiverOptionsConfigure, cancellationToken)

Starts receiving messages using a strongly-typed handler class in a fire-and-forget manner.

Parameters:

  • client - The Signal bot client instance.
  • receiverOptionsConfigure - Optional action to configure receiver options via ReceiverOptionsBuilder.
  • cancellationToken - Cancellation token to stop receiving messages.

StartReceiving

csharp
StartReceiving(client, updateHandler, errorHandler, receiverOptionsConfigure, cancellationToken)

Starts receiving messages using async delegate handlers for updates and errors in a fire-and-forget manner.

Parameters:

  • client - The Signal bot client instance.
  • updateHandler - Async delegate to handle received messages.
  • errorHandler - Async delegate to handle errors that occur during message reception.
  • receiverOptionsConfigure - Optional action to configure receiver options via ReceiverOptionsBuilder.
  • cancellationToken - Cancellation token to stop receiving messages.

StartReceiving

csharp
StartReceiving(client, updateHandler, errorHandler, receiverOptionsConfigure, cancellationToken)

Starts receiving messages using synchronous delegate handlers for updates and errors in a fire-and-forget manner.

Parameters:

  • client - The Signal bot client instance.
  • updateHandler - Synchronous delegate to handle received messages.
  • errorHandler - Synchronous delegate to handle errors that occur during message reception.
  • receiverOptionsConfigure - Optional action to configure receiver options via ReceiverOptionsBuilder.
  • cancellationToken - Cancellation token to stop receiving messages.

StartReceiving

csharp
StartReceiving(client, handler, receiverOptionsConfigure, cancellationToken)

Starts receiving messages using a custom handler implementation in a fire-and-forget manner. The receiver runs on a background task that continues until cancelled or an error occurs.

Parameters:

  • client - The Signal bot client instance.
  • handler - The handler implementing IReceivedMessageHandler to process messages and errors.
  • receiverOptionsConfigure - Optional action to configure receiver options via ReceiverOptionsBuilder.
  • cancellationToken - Cancellation token to stop receiving messages.

Exceptions:

  • System.ArgumentNullException - Thrown when botClient or handler is null.

ReceiveAsync``1

csharp
ReceiveAsync``1(client, receiverOptionsConfigure, cancellationToken)

Starts receiving messages using a strongly-typed handler class and returns a disposable to control the receiver lifecycle.

Parameters:

  • client - The Signal bot client instance.
  • receiverOptionsConfigure - Optional action to configure receiver options via ReceiverOptionsBuilder.
  • cancellationToken - Cancellation token to stop receiving messages.

Returns: An IAsyncDisposable that can be disposed to stop receiving messages.

ReceiveAsync

csharp
ReceiveAsync(client, updateHandler, errorHandler, receiverOptionsConfigure, cancellationToken)

Starts receiving messages using async delegate handlers and returns a disposable to control the receiver lifecycle.

Parameters:

  • client - The Signal bot client instance.
  • updateHandler - Async delegate to handle received messages.
  • errorHandler - Async delegate to handle errors that occur during message reception.
  • receiverOptionsConfigure - Optional action to configure receiver options via ReceiverOptionsBuilder.
  • cancellationToken - Cancellation token to stop receiving messages.

Returns: An IAsyncDisposable that can be disposed to stop receiving messages.

ReceiveAsync

csharp
ReceiveAsync(client, updateHandler, errorHandler, receiverOptionsConfigure, cancellationToken)

Starts receiving messages using synchronous delegate handlers and returns a disposable to control the receiver lifecycle.

Parameters:

  • client - The Signal bot client instance.
  • updateHandler - Synchronous delegate to handle received messages.
  • errorHandler - Synchronous delegate to handle errors that occur during message reception.
  • receiverOptionsConfigure - Optional action to configure receiver options via ReceiverOptionsBuilder.
  • cancellationToken - Cancellation token to stop receiving messages.

Returns: An IAsyncDisposable that can be disposed to stop receiving messages.

ReceiveAsync

csharp
ReceiveAsync(client, handler, receiverOptionsConfigure, cancellationToken)

Starts receiving messages using a custom handler implementation and returns a disposable to control the receiver lifecycle.

Parameters:

  • client - The Signal bot client instance.
  • handler - The handler implementing IReceivedMessageHandler to process messages and errors.
  • receiverOptionsConfigure - Optional action to configure receiver options via ReceiverOptionsBuilder.
  • cancellationToken - Cancellation token to stop receiving messages.

Returns: An IAsyncDisposable that can be disposed to stop receiving messages.