Jsonrpc.Server
Description: Reference for Jsonrpc.Server

### Class

# JsonrpcServer

#### Description [src]

    class Jsonrpc.Server : GObject.Object
    {
      /* No available fields */
    }

A server for JSON-RPC communication

The `JsonrpcServer` class can help you implement a JSON-RPC server. You can accept connections and then communicate with clients using the `JsonrpcClient` API.

#### Hierarchy

#### Ancestors

- GObject

#### Constructors

###### jsonrpc_server_new

Creates a new `JsonrpcServer`.

since: 3.26

#### Instance methods

###### jsonrpc_server_accept_io_stream

This function accepts `io_stream` as a new client to the `JsonrpcServer` by wrapping it in a `JsonrpcClient` and starting the message accept loop.

since: 3.26

###### jsonrpc_server_add_handler

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

since: 3.26

###### jsonrpc_server_foreach

Calls `foreach_func` for every client connected.

since: 3.28

###### jsonrpc_server_remove_handler

Removes a handler that was previously registered with `jsonrpc_server_add_handler()`.

since: 3.26

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Signals

###### Jsonrpc.Server::client-accepted

This signal is emitted when a new client has been accepted.

since: 3.28

###### Jsonrpc.Server::client-closed

This signal is emitted when a new client has been lost.

since: 3.30

###### Jsonrpc.Server::handle-call

This method is emitted when the client requests a method call.

since: 3.26

###### Jsonrpc.Server::notification

This signal is emitted when the client has sent a notification to us.

since: 3.26

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct JsonrpcServerClass {
      GObjectClass parent_class;
      gboolean (* handle_call) (
        JsonrpcServer* self,
        JsonrpcClient* client,
        const gchar* method,
        GVariant* id,
        GVariant* params
      );
      void (* notification) (
        JsonrpcServer* self,
        JsonrpcClient* client,
        const gchar* method,
        GVariant* params
      );
      void (* client_accepted) (
        JsonrpcServer* self,
        JsonrpcClient* client
      );
      void (* client_closed) (
        JsonrpcServer* self,
        JsonrpcClient* client
      );

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.

`handle_call: gboolean (* handle_call) ( JsonrpcServer* self, JsonrpcClient* client, const gchar* method, GVariant* id, GVariant* params )`

  No description available.

`notification: void (* notification) ( JsonrpcServer* self, JsonrpcClient* client, const gchar* method, GVariant* params )`

  No description available.

`client_accepted: void (* client_accepted) ( JsonrpcServer* self, JsonrpcClient* client )`

  No description available.

`client_closed: void (* client_closed) ( JsonrpcServer* self, JsonrpcClient* client )`

  No description available.

#### Virtual methods

###### Jsonrpc.ServerClass.client_accepted

No description available.

###### Jsonrpc.ServerClass.client_closed

No description available.

###### Jsonrpc.ServerClass.handle_call

No description available.

###### Jsonrpc.ServerClass.notification

No description available.