WebSocketConnection Type
A currently connected client.
Remarks
This type describes the connection of a client which is currently connected to the component. You may use the different fields of this type to manage the connection.
Fields
AcceptData Boolean |
Setting this property to False, temporarily disables data reception (and the DataIn event) on the connection. Setting this to True, re-enables data reception. | ||||||||||
BytesSent Integer |
This property shows how many bytes were sent after the last assignment to DataToSend. Please check DataToSend for more information. Note that this property will always return 0 when the component is operating in synchronous mode (that is, the Timeout property is set to a positive value.) | ||||||||||
Connected Boolean |
This property is used to disconnect individual connections and/or show their status. The Connected property may be set to false to close the connection. Connected also shows the status of a particular connection (connected/disconnected). | ||||||||||
ConnectionId String |
This property contains an identifier generated by the component to identify each connection. This identifier is unique to this connection. | ||||||||||
DataFormat TipeDataFormats |
The format of the data being sent. When data is sent over an established connection it is either considered as text or binary data. Text data is UTF-8 encoded. Binary data has no encoding associated with it. Possible values are:
| ||||||||||
DataToSend String |
This property contains a string of data to be sent to the remote host. Write-only property. Assigning a string to the DataToSend makes the component send the string to the remote host. The Send method provides similar functionality. If you are sending data to the remote host faster than it can process it, or faster than the network's bandwidth allows, the outgoing queue might fill up. When this happens, DataToSend raises the exception with errorcode 10035 and message '[10035] Operation would block' (WSAEWOULDBLOCK). You can handle this exception, and then try to send the data again. The BytesSent property shows how many bytes were sent (if any). If 0 bytes were sent, then you can wait for the ReadyToSend event before attempting to send data again. (However, please note that ReadyToSend is not fired when part of the data is successfully sent). | ||||||||||
DataToSendB TBytes |
This property contains a string of data to be sent to the remote host. Write-only property. Assigning a string to the DataToSend makes the component send the string to the remote host. The Send method provides similar functionality. If you are sending data to the remote host faster than it can process it, or faster than the network's bandwidth allows, the outgoing queue might fill up. When this happens, DataToSend raises the exception with errorcode 10035 and message '[10035] Operation would block' (WSAEWOULDBLOCK). You can handle this exception, and then try to send the data again. The BytesSent property shows how many bytes were sent (if any). If 0 bytes were sent, then you can wait for the ReadyToSend event before attempting to send data again. (However, please note that ReadyToSend is not fired when part of the data is successfully sent). | ||||||||||
Host String |
The Host header value of the connected client. | ||||||||||
LocalAddress String |
This property shows the IP address of the interface through which the connection is passing. LocalAddress is important for multi-homed hosts where it can be used to find which particular network interface an individual connection is going through. | ||||||||||
Origin String |
The Origin header value of the connected client. | ||||||||||
ReadyToSend Boolean |
Indicates whether the component is ready to send data. This property indicates that the underlying TCP/IP subsystem is ready to accept data. This is True after a client connects, and will become False after a failed DataToSend. After a failed DataToSend the ReadyToSend event will fire and this property will be True when data can be sent again. | ||||||||||
RemoteHost String |
This property shows the IP address of the connected client. The connection must be valid or an error will be fired. If the component is configured to use a SOCKS firewall, the value assigned to this property may be preceded with an "*". If this is the case, the host name is passed to the firewall unresolved and the firewall performs the DNS resolution. | ||||||||||
RemotePort Integer |
This property shows the port of the connected client. The connection must be valid or an error will be fired. | ||||||||||
RequestHeaders String |
The HTTP headers sent by the client in the initial WebSocket connection request. | ||||||||||
RequestURI String |
The requested URI sent by the client in the initial WebSocket connection request. | ||||||||||
SubProtocols String |
The subprotocols (application-level protocols layered over the WebSocket Protocol) sent by the client in the initial WebSocket connection request. | ||||||||||
Timeout Integer |
This property specifies a timeout for the component. If the Timeout property is set to 0, all operations return immediately, potentially failing with a WOULDBLOCK error if data cannot be sent immediately. If Timeout is set to a positive value, data is sent in a blocking manner and the component will wait for the operation to complete before returning control. The component will handle any potential WOULDBLOCK errors internally and automatically retry the operation for a maximum of Timeout seconds. The component will use DoEvents to enter an efficient wait loop during any potential waiting period, making sure that all system events are processed immediately as they arrive. This ensures that the host application does not "freeze" and remains responsive. If Timeout expires, and the operation is not yet complete, the component raises an exception. Please note that by default, all timeouts are inactivity timeouts, i.e. the timeout period is extended by Timeout seconds when any amount of data is successfully sent or received. The default value for the Timeout property is 0 (asynchronous operation). |
Constructors
constructor Create();