Glossary · Connection

Keep-alive

Keep-alive in OPC UA means two different mechanisms. The session keep-alive is a periodic cheap read the client makes to prove the session is alive and to detect a dead server. The subscription keep-alive is an empty NotificationMessage the server sends when a publishing cycle produced no data. Both exist because silence is ambiguous.

The session keep-alive is the client's job

Clients read Server, ServerStatus, CurrentTime - or the whole ServerStatus - on a timer of roughly a third of the revised session timeout, count consecutive failures, and trigger reconnection after two or three. Reference stacks expose this as a keep-alive interval plus a status event, and every reconnect handler is driven from it. It also yields a continuous clock-offset measurement, which matters because skew causes certificate errors.

The subscription keep-alive is the server's job

If a subscription produces no notifications for MaxKeepAliveCount publishing cycles, the server answers an outstanding Publish with a keep-alive message: sequence-number bookkeeping, no data. That tells the client the subscription still exists and the pipe is clear. It says nothing about whether the underlying process value is still being updated - that is a data-level question a heartbeat answers.

TCP keepalive is not a substitute

Operating-system TCP keepalive defaults to two hours on Linux and Windows, so a silently dropped connection - a NAT table expiry, a firewall state timeout, a pulled fibre - is invisible for far longer than any industrial application can tolerate. The application-level timers above are what actually detect it, and they are also what makes a half-open connection detectable at all.

Example

Three different silences, three different detectors

Session keep-alive       read ServerStatus every 10 s     detects: server or link gone
Subscription keep-alive  server sends every N cycles       detects: subscription deleted server-side
Data heartbeat           client re-emits last value        detects: value stopped updating

A subscription keep-alive arriving on time while a tag has not changed
for an hour proves the connection is healthy - and nothing about the tag.
The mistake people make: Assuming that arriving keep-alives mean the data is flowing. A subscription keep-alive proves only that the subscription exists and the transport works. Without a data heartbeat, a frozen PLC value and a perfectly steady process look identical on the wire, indefinitely.

Defined in: Part 4 - Services, Publish and the subscription keep-alive; session keep-alive is client behaviour, not a service.

Last verified 7 September 2026 against OPC UA 1.05.07. OPC UA Connect is an educational resource and is not affiliated with the OPC Foundation.

Free download
OPC UA Server Acceptance Test Pack
A 40-check acceptance test you run against a vendor's server before commissioning sign-off. Weighted scoring, three hard gates, and a one-page verdict for the supplier meeting.
Get the free test pack →
Free, no course, no login