Gio.SocketClient.prototype.set_tls

function set_tls(tls: Boolean): void {
    // Gjs wrapper for g_socket_client_set_tls()
}
  

Sets whether client creates TLS (aka SSL) connections. If tls is true, client will wrap its connections in a Gio.TlsClientConnection and perform a TLS handshake when connecting.

Note that since Gio.SocketClient must return a Gio.SocketConnection, but Gio.TlsClientConnection is not a Gio.SocketConnection, this actually wraps the resulting Gio.TlsClientConnection in a Gio.TcpWrapperConnection when returning it. You can use Gio.TcpWrapperConnection.prototype.get_base_io_stream on the return value to extract the Gio.TlsClientConnection.

If you need to modify the behavior of the TLS handshake (eg, by setting a client-side certificate to use, or connecting to the Gio.TlsConnection::accept-certificate signal), you can connect to client's Gio.SocketClient::event signal and wait for it to be emitted with Gio.SocketClientEvent.tls_handshaking, which will give you a chance to see the Gio.TlsClientConnection before the handshake starts.

Since 2.28

tls

whether to use TLS