connectionPoolMaxIdleConnections

Maximum number of idle connections to keep in the OkHttp connection pool.

When set to 0, connection pooling is disabled and connections are closed immediately after use.

Note: This setting affects only OkHttp's idle connection pool behavior. It does not control TCP keep-alive intervals used by the OS, the network, or PubNub servers, and it does not affect connections that are actively in use (e.g., long-poll subscribe requests).

The value must be non-negative.

Defaults to 5 (OkHttp default).

HTTP/2 impact: Setting this to 0 disables idle connection reuse, forcing a fresh TLS handshake on every request and eliminating HTTP/2 multiplexing benefits between request bursts. Use 0 only when per-request connection isolation is required for a specific compliance or security reason.

See also

ConnectionPool