Interface ExtensionMethodHandler

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @ExperimentalApi public interface ExtensionMethodHandler
Handles a single raw JSON-RPC method owned by a ServerExtension. Transport-neutral: the handler sees the stable InteractionContext and a provider-neutral JsonObject, never the underlying transport or server internals.

Register with ExtensionContext.registerHandler(String, ExtensionMethodHandler) from ServerExtension.bootstrap(ExtensionContext).

  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Object
    handle(InteractionContext interaction, @Nullable JsonObject params)
    Handles the method and returns the result to serialize as the JSON-RPC response.
  • Method Details

    • handle

      @Nullable Object handle(InteractionContext interaction, @Nullable JsonObject params) throws Exception
      Handles the method and returns the result to serialize as the JSON-RPC response.
      Parameters:
      interaction - the per-channel interaction view (protocol version, lifecycle, session)
      params - the method params as an immutable JSON object, or null when absent
      Returns:
      the result to serialize with the server's configured serde, or null for an empty result
      Throws:
      Exception - on handler failure; surfaced to the client as an internal-error