opcua-client-ext-transport-https · master
Docs · API

`HttpsTransport`

HttpsTransport — implements ClientTransportInterface for opc.https://, plugs into ClientBuilder::setTransport(), and orchestrates the HTTPS round-trips.

Fully qualified name: PhpOpcua\Client\ExtTransportHttps\HttpsTransport. Implements PhpOpcua\Client\Transport\ClientTransportInterface.

Constructor

method · public
returns void
__construct(HttpClientInterface \$httpClient, HttpsEncodingStrategy \$encoding, string \$endpointUrl, float \$timeoutSeconds = 30.0, ?LoggerInterface \$logger = null, ?EventDispatcherInterface \$dispatcher = null)
Parameters
httpClient
HttpClientInterface required

Backend that performs the POSTs. CurlHttpClient is shipped; PSR-18 wrappers are user-supplied.

encoding
HttpsEncodingStrategy required

The wire encoding. v4.4 ships BinaryHttpsEncoding (production-ready, see HTTPS Binary status) and JsonHttpsEncoding (foundation shipped, see HTTPS JSON status). XML SOAP and legacy SOAP/HTTP are roadmap.

endpointUrl
string required

opc.https://host:port/path or https://host:port/path. The constructor normalises opc.https:// to https://. Invalid scheme raises HttpsTransportException.

timeoutSeconds
float optional default 30.0

Per-request hard upper bound passed to the HTTP client.

logger
?LoggerInterface optional default null

Optional PSR-3 logger. Defaults to NullLogger.

dispatcher
?EventDispatcherInterface optional default null

Optional PSR-14 dispatcher. When null, events are not emitted.

Methods inherited from ClientTransportInterface

method · public
returns void
connect(string \$host, int \$port, ?float \$timeout = null): void

No-op — HTTPS is stateless. Throws ConnectionException if close() was called.

method · public
returns void
send(string \$data): void

If the frame starts with HEL, asks the encoding for a fake ACK and stores it; otherwise encodes the request via encodeRequest() and POSTs.

method · public
returns string
receive(): string

Returns the pending fake ACK if any, then the decoded HTTP response (re-wrapped in a synthetic UA-TCP frame).

method · public
returns void
setReceiveBufferSize(int \$size): void

Cap for the re-framed response size. Triggers ProtocolException on receive() when exceeded.

method · public
returns void
close(): void

Releases the HTTP client. Idempotent.

method · public
returns bool
isConnected(): bool

true until close() is called.

method · public
returns HttpsTransport
createProbe(): self

Returns a fresh HttpsTransport sharing the same HTTP client / encoding / endpoint, for use as the discovery probe.

method · public
returns bool
isSecureChannelExternal(): bool

Always true — TLS is the secure channel, the core skips OpenSecureChannel.

Events dispatched

When a dispatcher is supplied:

  • HttpsRequestSent — before the POST (url, contentType, bodyLength).
  • HttpsResponseReceived — after a 2xx response, before decoding (url, statusCode, bodyLength).
  • HttpsRequestFailed — on network failure (statusCode=0) or non-2xx (statusCode=<actual>), with the originating exception in cause.

Logging

  • INFO — none in the default path (HTTPS is too verbose; emit at application level if needed).
  • WARNING — non-2xx response; event-dispatcher throw caught.
  • ERRORHttpsRequestException from the HTTP backend.

Not thread-safe

The transport owns mutable buffers (pendingAck, pendingResponse); use one instance per Client.