### Method

# Jsonrpc Server add_handler

since: 3.26

#### Declaration [src]

    guint
    jsonrpc_server_add_handler (
      JsonrpcServer* self,
      const gchar* method,
      JsonrpcServerHandler handler,
      gpointer handler_data,
      GDestroyNotify handler_data_destroy
    )

#### Description [src]

Adds a new handler that will be dispatched when a matching `method` arrives.

Available since: 3.26

#### Parameters

`method`

  Type: `const gchar*`

  A method to handle.

  The data is owned by the caller of the function.
  The value is a NUL terminated UTF-8 string.

`handler`

  Type: `JsonrpcServerHandler`

  A handler to execute when an incoming method matches `methods`.

`handler_data`

  Type: `gpointer`

  User data for `handler`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`handler_data_destroy`

  Type: `GDestroyNotify`

  A destroy callback for `handler_data`.

#### Return value

Type: `guint`

A handler id that can be used to remove the handler with `jsonrpc_server_remove_handler()`.