ShowTypingMiddleware Class

  • java.lang.Object
    • com.microsoft.bot.builder.ShowTypingMiddleware

Implements

public class ShowTypingMiddleware
implements Middleware

When added, this middleware will send typing activities back to the user when a Message activity is received to let them know that the bot has received the message and is working on the response. You can specify a delay in milliseconds before the first typing activity is sent and then a frequency, also in milliseconds which determines how often another typing activity is sent. Typing activities will continue to be sent until your bot sends another message back to the user.

Constructor Summary

Constructor Description
ShowTypingMiddleware()

Constructs with default delay and period.

ShowTypingMiddleware(long withDelay, long withPeriod)

Initializes a new instance of the ShowTypingMiddleware class.

Method Summary

Modifier and Type Method and Description
java.util.concurrent.CompletableFuture<java.lang.Void> onTurn(TurnContext turnContext, NextDelegate next)

Processes an incoming activity.

Methods inherited from java.lang.Object

java.lang.Object.clone java.lang.Object.equals java.lang.Object.finalize java.lang.Object.getClass java.lang.Object.hashCode java.lang.Object.notify java.lang.Object.notifyAll java.lang.Object.toString java.lang.Object.wait java.lang.Object.wait java.lang.Object.wait

Constructor Details

ShowTypingMiddleware

public ShowTypingMiddleware()

Constructs with default delay and period.

ShowTypingMiddleware

public ShowTypingMiddleware(long withDelay, long withPeriod)

Initializes a new instance of the ShowTypingMiddleware class.

Parameters:

withDelay - Initial delay before sending first typing indicator.
withPeriod - Rate at which additional typing indicators will be sent.

Throws:

java.lang.IllegalArgumentException - delay and period must be greater than zero

Method Details

onTurn

public CompletableFuture onTurn(TurnContext turnContext, NextDelegate next)

Processes an incoming activity.

Parameters:

turnContext - The context object for this turn.
next - The delegate to call to continue the bot middleware pipeline.

Returns:

A task that represents the work queued to execute.

Applies to