The JSON-RPC module is an implementation of the OSGi Remote Service Specification. It exports OSGi services as remote JSON-RPC methods.
The module can be used for:
Remote Method Invocation via HTTP server
Remote Eventing via HTTP or WebSockets Server
The components of the module and the usage scenarios are described below.
Remote Method Invocation
Application – invokes JSON-RPC methods to communicate with the OSGi HTTP Service Implementation, i.e. the HTTP Server.
HTTP Server – processes and forwards these method calls to the JSON-RPC Distribution Provider.
JSON-RPC Distribution Provider – maps the invoked JSON-RPC method calls to the corresponding Remote Services. It handles the security as well.
Remote Services – register services in the OSGi framework, which implement the application's specific remote methods, following the OSGi Remote Services specification.
Remote Eventing
For the JSON-RPC module the Remote Eventing functions as follows:
In JSON-RPC Remote Events Pull the information is requested continuously – Long Polling. To get an event, the Application invokes JSON-RPC methods. A protocol is followed for subscription and reception of event messages from the OSGi Event Admin.
In JSON-RPC Remote Events Push the Application subscribes for/ receives events via a WebSockets Application, deployed on a WebSockets Server. Once the connection has been established, the WebSockets Application sends the events as JSON objects. For further information on the communication with the WebSockets Application, refer to the WebSocket's OSGi Events Application Specification.
The serialization of events is done through a pluggable mechanism. Thus the user can use Gson, Jackson or custom implementation.