|Home > Generic function call interface > JSON-RPC 2.0 over HTTP > Persistent connections|
The IrisTcpServer only supports keep-alive mode, which keeps the TCP connection open, even after responding to a request. Clients must send
Connection: keep-alive in the header in every request. Clients can close the TCP connection at any time to end the session.
The IrisTcpServer does not support the no keep-alive mode, because closing the TCP
connection implies the client is disconnecting. If a client calls
instanceRegistry_registerInstance() without keep-alive, it
would receive a response and would be assigned an instance id, but when the client
or server closes the TCP connection, the client would automatically be removed from
the instance registry and therefore could not make any more Iris function calls.
The IrisTcpServer accepts and produces chunked transfer encoding messages to
implement bi-directional Iris messages. The client can send Iris messages either as
a sequence of
POST requests, or as a sequence of
chunks of an initial
POST request, or any
combination. The IrisTcpServer responds with a sequence of chunks, until it receives
POST request from the client. An
end-of-chunks marker carries no semantic information. Switching between chunks and
POST requests has no meaning. Clients must
accept chunked transfer encoding. The IrisTcpServer does not send
HTTP requests, for example
POST, to the client.
As an alternative to using chunked transfer encoding, web sockets can be used to create a persistent connection between the client and the server.
Long polling cannot be used because it implies that a new TCP connection is created by the client to receive future events.