Table of Contents

IWebSocket Interface

Interface for managing WebSocket communication, including sending and receiving messages, and handling connection states.

Syntax

Unit: Sparkle.WebSocket

IWebSocket = interface(IInterface);

Methods

Name Description
Send Overloaded
Send(string)
Send(TArray<Byte>)
Receive Receives a full message from the WebSocket connection, automatically handling any fragments.
SendFrame Sends a WebSocket frame to the connection. Allows sending individual frames with control over fragmentation.
ReceiveFrame Receives a WebSocket frame from the connection. Allows receiving individual frames with control over fragmentation.
Close Initiates the WebSocket close handshake by sending a close frame and waiting for the other side to acknowledge with its own close frame.
SendClose Sends a close frame in response to a close frame received from the other side, finishing the close handshake without waiting for a response.
Abort Aborts the WebSocket connection immediately without sending a close frame.
GetState Gets the current state of the WebSocket connection.
GetCloseStatus Gets the status code indicating the reason for the WebSocket connection closure.
GetCloseStatus​Description Gets the description of the WebSocket connection closure status.

Properties

Name Description
State The current state of the WebSocket connection.
CloseStatus The status code indicating the reason for the WebSocket connection closure.
CloseStatusDescription The description of the WebSocket connection closure status.