JsonRpcServer

Description

The JsonRpcServer object provides a JSON-RPC 2.0 compliant server. Basic network parameters can be customized through the port and localHost properties. In order to expose functions and properties via JSON-RPC at least one JsonRpcService has to be defined and assigned to the services property.

› Inherits:Object

Properties

debugRpcMessages

This property holds whether to log received and sent RPC messages to the console for debugging purposes.

This property was introduced in InCore 2.2.

› Type:Boolean
› Default:false
› Signal:debugRpcMessagesChanged()
› Attributes:Writable

localHost

This property holds whether the server should listen for incoming connections on the local loopback interface only. If set to true the server will not be reachable by other hosts on the network but internal clients such as docker containers (DockerContainer) only. Additionally the WebServerService proxies requests to the default port 5080 to a local server. This means if WebServerService is used and the JSON-RPC server should not be exposed on non-local network interfaces a port other than 5080 has to be used.

› Type:Boolean
› Default:true
› Signal:localHostChanged()
› Attributes:Writable

port

This property holds the TCP port of the JSON-RPC server.

› Type:SignedInteger
› Default:5080
› Signal:portChanged()
› Attributes:Writable

services

This property holds a list of JsonRpcService objects which exposes the desired functions and properties.

This property was introduced in InCore 2.5.

› Type:List<JsonRpcService>
› Signal:servicesChanged()
› Attributes:Readonly

Signals

servicesDataChanged(SignedInteger index)

This signal is emitted whenever the List.dataChanged() signal is emitted, i.e. the item at index in the services list itself emitted the dataChanged() signal.

Example

See JsonRpcService example on how to use JsonRpcServer.