TTMSMCPSseTransport Class
Message channel that serves clients over HTTP using two endpoints: a long-lived event stream the server pushes answers down, and a separate address the client posts requests to.
API unit family: TMS.MCP.Transport.SSE
Inherits from: TTMSMCPTransport
Syntax
TTMSMCPSseTransport = class(TTMSMCPTransport)
Remarks
This is the older two-endpoint HTTP arrangement, kept for clients that still speak it. It accepts only the legacy protocol versions and rejects a request carrying any newer version header. New work should use the single-endpoint streaming channel (TTMSMCPStreamableHTTPTransport), which supports the current protocol versions and tracks real sessions. A client first opens the stream endpoint with a GET. The channel answers with an event telling the client which address to post to, and holds that connection open, keeping it alive with a comment line roughly every fifteen seconds. Requests then arrive as POSTs to the message endpoint, and answers are pushed back down the stream rather than returned in the POST response - the POST itself is answered 202 for a request and 204 for a notification. A client is recognized only by its remote address and port, which is how it is matched to its open stream; there are no session identifiers, so the session-aware members inherited from TTMSMCPTransport keep reporting that there are no sessions and cannot be used to push a notification to one client. Every response is sent with a cross-origin header allowing any origin, and the channel does not check where a request came from. Bind it to a local address and treat it as a local channel; put a reverse proxy in front of it if it has to be reachable from elsewhere.
Properties
| Name | Description |
|---|---|
| CertFile | Certificate the listener serves encrypted connections with. |
| KeyFile | Path of the private key belonging to the certificate. |
| KeyPassword | Password protecting the private key, when it has one. |
| MessageEndpoint | Path a client posts requests to. Defaults to /message. |
| Port | Port the channel listens on. Defaults to 8934. |
| SSEEndpoint | Path a client opens to receive the event stream. Defaults to /sse. |
| UseSSL | Whether the listener serves encrypted connections. Defaults to False. |
Methods
| Name | Description |
|---|---|
| ConfigureSSL | Turns on encryption and records the certificate to serve it with. |
| DisableSSL | Turns off encryption and clears the recorded certificate settings. |
| GetServerURL | Returns the base address the channel listens on. |
| IsSSLConfigured | Reports whether encryption is switched on and a certificate has been named. |
| ProcessMessages | Does nothing on this channel. |
| Run | Starts the channel if needed and parks the calling thread until it stops. |
| Start | Opens the listening port and starts the worker threads. |
| Stop | Closes the listening port, drops connected clients and stops the worker threads. |
Events
| Name | Description |
|---|---|
| OnLog | Handler receiving the channel's progress and diagnostic lines. |