JSON Adapter/SessionManagment


The p≡p JSON server adapter MUST support multiple clients. Each client is identified by a Client Session. Each PEP_SESSION MUST be mapped to a Client Session where it is used from. The mapping is n:1, PEP_SESSION ↦ Client Session (multiple PEP_SESSION per Client Session).

Network service

The p≡p JSON server adapter is offering JSON RPC via HTTP via TCP. Additionally, it MAY offer Websocket protocol via TCP. In the p≡p JSON server adapter each TCP socket is running in one TCP Connection Thread, respectively. To each TCP Connection Thread there is one PEP_SESSION assigned, respectively.

Client ID

To assign a Client Session the Application MUST deliver a Client ID. The Client ID is a UUID Version 4. The Client ID has to be delivered with each JSON-RPC request as field "client_id":

    "jsonrpc":"2.0", "id":4711, "security_token":"sNa3FuGlUQvAwJeJpSK_Z0pQZvHjqO9F3ImGm0m",
    "client_id": "459a0141-a294-48e0-9857-03084f526218",
    "method":"serverVersion", "params":[]

The Client ID MUST be stable while an application is running. If an Application can be started multiple times it MUST be unique per running instance. The Client ID MAY change each time an Application instance is starting but not while runtime.

An Application instance MUST NOT use multiple Client IDs at the same time. An Application MAY use multiple TCP sockets to the p≡p JSON server adapter at the same time. In this case it MUST deliver the same Client ID with all calls.

State of Config Cache

The p≡p JSON server adapter MUST guarantee Config Cache coherence for each Client Session, respectively, while an Application instance is continuously using TCP sockets with the same Client ID. This can be easiest achieved by implementing one Config Cache per Client ID. When there is a time without a TCP socket the p≡p JSON server adapter MAY drop the state of the Config Cache. It is expected to do this after some timeout. The timeout is implementation defined.

An Application MUST deliver its p≡p session configuration by calling the required config API when opening the first connection AND when re-opening a first connection after closing all TCP sockets.