Skip to content

ClientConfig

Canonical path: o6.ClientConfig

ClientConfig

Configuration of one Client, reached as client.config.

The client owns its config; assign to these attributes instead of replacing the object. Most settings only take effect on the next connect, so configure the client before connecting.

See Everything else goes on client.config.

Attributes

logger instance-attribute

logger

Redirect client log output to a Python logger. Write-only.

timeout instance-attribute

timeout

Request timeout in milliseconds.

endpointUrl instance-attribute

endpointUrl

Server URL to connect to. Required before any connect.

endpoint instance-attribute

endpoint

A complete EndpointDescription that pins the exact endpoint.

Usually taken from Client.getEndpoints(), and set instead of letting the client select an endpoint from endpointUrl and the security settings.

securityMode instance-attribute

securityMode

MessageSecurityMode to request; see o6.SecurityMode.

securityPolicyUri instance-attribute

securityPolicyUri

Full URI of the security policy to request.

securityPolicy instance-attribute

securityPolicy

Security policy as a short name, e.g. "Basic256Sha256".

An enum-friendly view of securityPolicyUri; the setter also accepts an o6.SecurityPolicy member.

applicationUri instance-attribute

applicationUri

URI advertised in the ApplicationDescription.

On a secured channel this must match the URI inside the client certificate.

applicationDescription instance-attribute

applicationDescription

The whole ApplicationDescription, for full control over discovery data.

userIdentityToken instance-attribute

userIdentityToken

User identity token sent on ActivateSession, as an ExtensionObject.

The setUsernamePassword and setAuthenticationCert methods fill this in for the common cases.

userTokenPolicy instance-attribute

userTokenPolicy

UserTokenPolicy that the identity token is encrypted for.

noSession instance-attribute

noSession

Operate on the SecureChannel alone, without creating a Session.

Set by Client.connectSecureChannel(); assigning it directly is not how a channel-only connection is established.

noReconnect instance-attribute

noReconnect

Do not reconnect automatically after the connection is lost.

noNewSession instance-attribute

noNewSession

Do not create a replacement Session when the old one cannot be reused.

tcpReuseAddr instance-attribute

tcpReuseAddr

Set SO_REUSEADDR on the client socket.

allowNonePolicyPassword instance-attribute

allowNonePolicyPassword

Permit a username/password token on an unencrypted channel.

Off by default, because it sends the password in clear text.

sessionName instance-attribute

sessionName

Session name shown by the server's session diagnostics.

secureChannelLifeTime instance-attribute

secureChannelLifeTime

Requested SecureChannel lifetime in milliseconds, before renewal.

requestedSessionTimeout instance-attribute

requestedSessionTimeout

Requested Session timeout in milliseconds.

connectivityCheckInterval instance-attribute

connectivityCheckInterval

Keepalive interval in milliseconds. 0 disables the check.

outstandingPublishRequests instance-attribute

outstandingPublishRequests

How many Publish requests are kept in flight for subscriptions.

authSecurityPolicyUri instance-attribute

authSecurityPolicyUri

Security policy URI used to encrypt the user identity token.

Defaults to the channel's own policy.

maxTrustListSize instance-attribute

maxTrustListSize

Byte limit for the trust list. 0 means no limit.

maxRejectedListSize instance-attribute

maxRejectedListSize

Maximum number of rejected certificates kept. 0 means no limit.

sessionLocaleIds instance-attribute

sessionLocaleIds

Preferred locale IDs for the Session, most preferred first.

namespaces instance-attribute

namespaces

Namespace URIs the client itself declares, indexed as given.

sendBufferSize instance-attribute

sendBufferSize

Transport send-buffer size in bytes.

recvBufferSize instance-attribute

recvBufferSize

Transport receive-buffer size in bytes.

localMaxMessageSize instance-attribute

localMaxMessageSize

Largest message the client accepts, in bytes. 0 means no limit.

localMaxChunkCount instance-attribute

localMaxChunkCount

Largest number of chunks the client accepts. 0 means no limit.

certificate property writable

certificate

The client's own certificate, as DER bytes.

Accepts a path string, a Path, or raw DER or PEM bytes; reads back as DER. Setting it stores the value until it is applied on connect.

privateKey property writable

privateKey

The client's own private key, as DER bytes.

Accepts a path string, a Path, or raw DER or PEM bytes.

trustList property writable

trustList

Certificates the client trusts, as DER bytes.

Accepts path strings, Path objects, or raw DER or PEM bytes.

revocationList property writable

revocationList

Certificate revocation lists for trustList, as DER bytes.

Functions

setUsernamePassword

setUsernamePassword(username, password)

Authenticate the session with a username and password.

On an unencrypted channel this needs allowNonePolicyPassword, because the password would travel in clear text.

setCredentials

setCredentials(username, password)

setEncryption

setEncryption(
    certificate, privateKey, trustList, revocationList
)

Configure channel encryption in one call.

Equivalent to assigning certificate, privateKey, trustList, and revocationList, but applied immediately rather than on connect.

Parameters:

Name Type Description Default
certificate bytes

Client certificate, as DER or PEM bytes.

required
privateKey bytes

Matching private key, as DER or PEM bytes.

required
trustList list[bytes]

Trusted certificates, as DER or PEM bytes.

required
revocationList list[bytes]

Certificate revocation lists.

required

Raises:

Type Description
StatusCodeError

open62541 rejected the material.

setAuthenticationCert

setAuthenticationCert(certificate, privateKey)

Authenticate the session with an X.509 user certificate.

Parameters:

Name Type Description Default
certificate bytes

User certificate, as DER or PEM bytes.

required
privateKey bytes

Matching private key, as DER or PEM bytes.

required

Raises:

Type Description
StatusCodeError

open62541 rejected the material.