Table of Contents

TTMSFNCWebSocketServer Class

WebSocket server component. Publishes the configuration properties and events of TTMSFNCCustomWebSocketServer so they can be set at design time, and listens for connections to exchange messages and control frames with connected clients.

API unit family: TMSFNCWebSocketServer Inherits from: TTMSFNCCustomWebSocketServer

Syntax

TTMSFNCWebSocketServer = class(TTMSFNCCustomWebSocketServer)

Properties

Name Description
Active Starts or stops the server. Set to True to begin listening on the configured port; set to False to stop. Defaults to False. (inherited from TTMSFNCCustomWebSocketServer)
AutoSyncEvents Determines whether received-message and connection events are automatically dispatched on the main thread. When True handlers run synchronized with the main thread; when False they run on the connection's worker thread and the handler is responsible for thread safety. (inherited from TTMSFNCCustomWebSocketServer)
BindingIP The local IP address the server binds to. Leave empty to listen on all available addresses. (inherited from TTMSFNCCustomWebSocketServer)
CertificateFile Path to the server certificate file used for secure connections. (inherited from TTMSFNCCustomWebSocketServer)
CertificateKeyFile Path to the private key file paired with the server certificate. (inherited from TTMSFNCCustomWebSocketServer)
FrameSize The maximum size, in bytes, of each frame when SplitMessage is enabled. Has no effect when message splitting is disabled. Defaults to 0. (inherited from TTMSFNCCustomWebSocketServer)
Options The set of protocol behavior options applied to each connection. (inherited from TTMSFNCCustomWebSocketServer)
PathName When set to a non-empty value, only requests whose path matches this value are accepted. Other requests receive a not-found response. Leave empty to accept any path. (inherited from TTMSFNCCustomWebSocketServer)
Port The TCP port the server listens on for incoming connections. (inherited from TTMSFNCCustomWebSocketServer)
RootCertificateFile Path to the root (CA) certificate file used to validate the certificate chain. (inherited from TTMSFNCCustomWebSocketServer)
SplitMessage Determines whether outgoing messages are split into multiple frames. When True, messages are sent in frames of FrameSize bytes. Defaults to False. (inherited from TTMSFNCCustomWebSocketServer)
UseSSL Determines whether connections are secured. When True the server uses a secure I/O handler configured from the certificate properties. Defaults to False. (inherited from TTMSFNCCustomWebSocketServer)

Methods

Name Description
BroadcastData Sends binary data to every connection whose handshake has completed. (inherited from TTMSFNCCustomWebSocketServer)
BroadcastMessage Sends a text message to every connection whose handshake has completed. (inherited from TTMSFNCCustomWebSocketServer)
DisconnectClient Sends a close frame to the connections accepted by the selector, disconnecting them. (inherited from TTMSFNCCustomWebSocketServer)
SendDataTo Sends binary data to the connections accepted by the selector. (inherited from TTMSFNCCustomWebSocketServer)
SendMessageTo Sends a text message to the connections accepted by the selector. (inherited from TTMSFNCCustomWebSocketServer)
TransformCloseData Extracts the status code and optional reason text from the payload of a received close frame. (inherited from TTMSFNCCustomWebSocketServer)

Events

Name Description
OnAllow Occurs after the handshake request has been received, allowing the handler to reject the connection by clearing the allow parameter. (inherited from TTMSFNCCustomWebSocketServer)
OnBinaryDataReceived Occurs when binary data is received from a connection. (inherited from TTMSFNCCustomWebSocketServer)
OnClose Occurs when a close control frame is received from a connection. (inherited from TTMSFNCCustomWebSocketServer)
OnConnect Occurs when a new connection is established. (inherited from TTMSFNCCustomWebSocketServer)
OnCreateIOHandler Occurs when the secure I/O handler is being created, allowing a custom handler to be supplied. (inherited from TTMSFNCCustomWebSocketServer)
OnDisconnect Occurs when a connection is disconnected. (inherited from TTMSFNCCustomWebSocketServer)
OnGetSSLPassword Occurs when the password protecting the certificate or key file is required. (inherited from TTMSFNCCustomWebSocketServer)
OnHandshakeResponseSent Occurs after the handshake response has been sent to a connection. (inherited from TTMSFNCCustomWebSocketServer)
OnMessageReceived Occurs when a text message is received from a connection. (inherited from TTMSFNCCustomWebSocketServer)
OnPing Occurs when a ping control frame is received from a connection. (inherited from TTMSFNCCustomWebSocketServer)
OnPong Occurs when a pong control frame is received from a connection. (inherited from TTMSFNCCustomWebSocketServer)

Used by