OPC UA separates a SecureChannel from the Session that uses it. Renewing a SecureChannel issues new SecurityToken material for an existing channel. It does not create a new Session, repeat CreateSession, or discard the subscriptions and monitored items already owned by that Session.
That separation lets a long-running robot client rotate cryptographic keys without rebuilding its application context. Confusing the two lifetimes can cause unnecessary resubscription, duplicate monitoring, lost sequence state, or gaps during routine token renewal.
## Channel tokens have finite lifetimes
OpenSecureChannel opens or renews a SecureChannel used to protect message confidentiality and integrity. A channel contains SecurityTokens that identify cryptographic keys. The server returns a revised lifetime, and the client uses it to renew before expiration.
OPC UA Part 4 recommends requesting a new token after about 75 percent of its lifetime. The overlap rules allow old and new tokens briefly so messages delayed by the network are not rejected. The server continues to use the old token until it expires or receives a message protected with the new token. The client begins sending with the new token after processing the renewal response and can accept late messages under the specified overlap.
A RENEW request creates a new SecurityToken for the existing SecureChannel. The channel identifier and application relationship remain. The client must generate a new nonce, and security validation continues. These steps are key rotation, not Session creation.
## Session state belongs to another layer
A Session represents the application relationship and user context. It owns application-level state such as subscriptions. It communicates over a SecureChannel, but the binding is flexible. Part 2 explains that a Session can remain valid for a period after a channel breaks so the client can re-establish secure communication.
During ordinary token renewal, service requests continue in the same Session. AuthenticationToken use, subscription identifiers, monitored-item identifiers, NotificationMessage sequence numbers, and user authorization context are not reset merely because the channel gets a new token.
A client should therefore keep separate state machines for channel-token renewal and Session lifecycle. The renewal timer follows revisedLifetime. The Session timer and keep-alive logic follow Session and Subscription rules. One timer expiring should not be interpreted as the other object's intentional destruction.
## Broken channel recovery is different from renewal
If the connection or SecureChannel is lost, Part 4 recommends creating a new SecureChannel and calling ActivateSession to attach the existing Session to it. The client uses the same security policy, application certificate, and user credentials. If activation succeeds, the Session and its subscriptions can be reused.
Only if ActivateSession fails should the client create a new Session. It can then attempt TransferSubscriptions. If transfer fails, it must create new subscriptions. This ordered recovery avoids multiplying resources and preserves queued information when server capacity and monitored-item queues allow.
After reconnect, the client uses Republish from the next expected Subscription sequence number until the server reports Bad_MessageNotAvailable. Renewal alone does not require this recovery sequence because the connection and Session have not been lost.
## Identity and policy checks still matter
The fact that a Session survives channel changes does not mean any channel can claim it. ActivateSession on a different SecureChannel requires proof that the client application is the same. The server verifies the application certificate, SecurityPolicy, SecurityMode, and user identity against the established Session. Once accepted, requests through the old channel are rejected.
Certificate and trust checks also continue at token renewal. A client must treat renewal failure as a security or connectivity event, not paper over it by silently creating new application state. Record the channel identifier, token identifier, creation time, revised lifetime, selected policy and mode, certificate identity, and renewal result.
## A robotics client timeline
Suppose a cell-monitoring client creates one Session and a Subscription holding 200 robot variables. Its SecureChannel token lifetime is 60 minutes. At 45 minutes, the client renews and receives a new token. The same Session and Subscription continue; notification sequence numbers advance normally.
If the network then breaks, the client opens a new channel and activates the existing Session. It requests missing messages with Republish. Only when activation fails does it move to new-Session and transfer logic. Treating the 45-minute renewal as a reconnect would add work and risk duplicate monitored items for no benefit.
## Test the layers independently
Shorten token lifetime in a test environment and verify several renewals while the Session identifier, subscriptions, and sequence stream remain stable. Inject delayed messages across the token overlap. Then break the connection and verify new-channel ActivateSession recovery. Finally, expire or close the Session and confirm that channel renewal cannot revive application state that no longer exists.
Monitor renewals before production. Alert on repeated failures, late renewal, unexpected certificate changes, activation failures, subscription transfer failures, and gaps that Republish cannot fill. Keep these metrics separate so operators know whether the problem is cryptographic rotation, transport recovery, Session validity, or subscription retention.
SecureChannel renewal and Session creation solve different lifetime problems. Renewal limits key use while preserving a working application relationship. Session recovery preserves robot monitoring state across a broken channel when identity checks succeed. Clients that model those layers separately rotate security material without rebuilding the control context.