I have some simple PHP code that creates a SSL connection
$streamContext = stream_context_create();
stream_context_set_option($streamContext, 'ssl', 'local_cert', $this->sslPem);
stream_context_set_option($streamContext, 'ssl', 'passphrase', $this->passPhrase);
$this->apnsConnection = stream_socket_client('ssl://'.$this->apnsHost.':'.$this->apnsPort, $error, $errorString, 60, STREAM_CLIENT_CONNECT, $streamContext);
But know how to set SO_KEEPALIVE to true? I've also tried STREAM_CLIENT_PERSISTENT, which is not the same thing.