Table of Contents

TTMSMCPHTTPServerConnection Class

One open connection, for writing to a client outside the normal request and answer.

API unit family: TMS.MCP.HTTPServer Inherits from: TPersistent

Syntax

TTMSMCPHTTPServerConnection = class(TPersistent)

Remarks

Created and owned by the server and handed to a handler alongside the request and the response; do not free it. It is what a handler uses to keep writing after it has returned, which is how a long-lived event stream is served: send the headers, clear TTMSMCPHTTPServerResponse.CloseConnection, keep the connection, and write to it later. A connection kept in this way may be closed by the client at any moment, and a write to a closed connection fails, so writes must be guarded. The concrete behavior comes from the platform's own server implementation.

Methods

Name Description
Disconnect Closes the connection.
ReadBytes Reads bytes from the connection into a buffer.
Write Writes raw bytes to the connection.
WriteLn Writes text to the connection followed by a line ending.