WebSocketServer Control
Properties Methods Events Configuration Settings Errors
The WebSocketServer control is used to create a WebSocket server.
Syntax
WebSocketServer
Remarks
The WebSocketServer control provides an easy way to accept connections from WebSocket clients and transfer data.
The WebSocketServer control is a server that accepts incoming WebSocket connections and provides an easy way to send and receive data over the connection.
To begin using the control first specify a valid value for LocalPort. This is the port on which incoming connections will be accepted. To begin listening set Listening to True.
When a client connects the WebSocketOpenRequest event will fire. To accept the connection simply allow the event to complete. To reject the request set the StatusCode parameter to an HTTP error code (such as 401).
Once the connection is received incoming data will be provide through the DataIn event. To send data to a client you may use the Send, SendText, or SendFile methods. You may also set WebSocketConnectionDataToSend.
Note: Server components are designed to process events as they occur. To ensure events are processed in a timely manner DoEvents should be called in a loop after the server is started.
Property List
The following is the full list of the properties of the control with short descriptions. Click on the links for further details.
ConnectionBacklog | The maximum number of pending connections maintained by the TCP/IP subsystem. |
WebSocketConnectionCount | The number of records in the WebSocketConnection arrays. |
WebSocketConnectionAcceptData | Setting this property to False, temporarily disables data reception (and the DataIn event) on the connection. |
WebSocketConnectionBytesSent | This property shows how many bytes were sent after the last assignment to DataToSend . |
WebSocketConnectionConnected | This property is used to disconnect individual connections and/or show their status. |
WebSocketConnectionConnectionId | This property contains an identifier generated by the control to identify each connection. |
WebSocketConnectionDataFormat | The format of the data being sent. |
WebSocketConnectionDataToSend | This property contains a string of data to be sent to the remote host. |
WebSocketConnectionHost | The Host header value of the connected client. |
WebSocketConnectionLocalAddress | This property shows the IP address of the interface through which the connection is passing. |
WebSocketConnectionOrigin | The Origin header value of the connected client. |
WebSocketConnectionReadyToSend | Indicates whether the control is ready to send data. |
WebSocketConnectionRemoteHost | This property shows the IP address of the connected client. |
WebSocketConnectionRemotePort | This property shows the port of the connected client. |
WebSocketConnectionRequestHeaders | The HTTP headers sent by the client in the initial WebSocket connection request. |
WebSocketConnectionRequestURI | The requested URI sent by the client in the initial WebSocket connection request. |
WebSocketConnectionSubProtocols | The subprotocols (application-level protocols layered over the WebSocket Protocol) sent by the client in the initial WebSocket connection request. |
WebSocketConnectionTimeout | This property specifies a timeout for the control. |
DefaultTimeout | An initial timeout value to be used by incoming connections. |
Listening | If True, the control accepts incoming connections on LocalPort. |
LocalHost | The name of the local host or user-assigned IP interface through which connections are initiated or accepted. |
LocalPort | The TCP port in the local host where the control listens. |
SSLAuthenticateClients | If true, the server asks the client(s) for a certificate. |
SSLCertEncoded | The certificate (PEM/base64 encoded). |
SSLCertStore | The name of the certificate store for the client certificate. |
SSLCertStorePassword | If the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store. |
SSLCertStoreType | The type of certificate store for this certificate. |
SSLCertSubject | The subject of the certificate used for client authentication. |
UseSSL | Determines if SSL is negotiated with incoming connections. |
Method List
The following is the full list of the methods of the control with short descriptions. Click on the links for further details.
Config | Sets or retrieves a configuration setting. |
Disconnect | Disconnect the specified client. |
DoEvents | Processes events from the internal message queue. |
Interrupt | Interrupts a synchronous send to the remote host. |
Send | Sends binary data to the client. |
SendFile | Send file to the remote host. |
SendText | Sends text data to the client. |
Shutdown | Shuts down the server. |
Event List
The following is the full list of the events fired by the control with short descriptions. Click on the links for further details.
Connected | Fired when a WebSocket is successfully opened. |
ConnectionRequest | Fired when a request for connection comes from a remote host. |
DataIn | Fired when data is received. |
Disconnected | Fired when a WebSocket connection is disconnected. |
Error | Information about errors during data delivery. |
Log | Fires once for each log message. |
ReadyToSend | Fired when the control is ready to send data. |
SSLClientAuthentication | Fired when the client presents its credentials to the server. |
SSLConnectionRequest | Fires when an SSL connection is requested. |
SSLStatus | Shows the progress of the secure connection. |
WebSocketOpenRequest | Fired when a client attempts to open a WebSocket. |
Configuration Settings
The following is a list of configuration settings for the control with short descriptions. Click on the links for further details.
BufferMessage | Indicates whether or not the entire message is buffered before firing the DataIn event. |
DisconnectStatusCode | Specifies the status code when closing a connection. |
DisconnectStatusDescription | Specifies the message associated with the disconnect status code. |
MaxFrameSize | Specifies the maximum size of the outgoing message in bytes before fragmentation occurs. |
MessageLength[ConnectionId] | The length of the message (in bytes) when sending asynchronously. |
WaitForCloseResponse | Determines whether or not the control will forcibly close a connection. |
AllowedClients | A comma-separated list of host names or IP addresses that can access the control. |
BindExclusively | Whether or not the control considers a local port reserved for exclusive use. |
DefaultConnectionTimeout | The inactivity timeout applied to the SSL handshake. |
InBufferSize | The size in bytes of the incoming queue of the socket. |
KeepAliveInterval | The retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received. |
KeepAliveTime | The inactivity time in milliseconds before a TCP keep-alive packet is sent. |
MaxConnections | The maximum number of connections available. |
OutBufferSize | The size in bytes of the outgoing queue of the socket. |
TcpNoDelay | Whether or not to delay when sending packets. |
UseIPv6 | Whether to use IPv6. |
LogSSLPackets | Controls whether SSL packets are logged when using the internal security API. |
OpenSSLCADir | The path to a directory containing CA certificates. |
OpenSSLCAFile | Name of the file containing the list of CA's trusted by your application. |
OpenSSLCipherList | A string that controls the ciphers to be used by SSL. |
OpenSSLPrngSeedData | The data to seed the pseudo random number generator (PRNG). |
ReuseSSLSession | Determines if the SSL session is reused. |
SSLCACerts | A newline separated list of CA certificate to use during SSL client authentication. |
SSLCheckCRL | Whether to check the Certificate Revocation List for the server certificate. |
SSLCipherStrength | The minimum cipher strength used for bulk encryption. |
SSLEnabledCipherSuites | The cipher suite to be used in an SSL negotiation. |
SSLEnabledProtocols | Used to enable/disable the supported security protocols. |
SSLEnableRenegotiation | Whether the renegotiation_info SSL extension is supported. |
SSLIncludeCertChain | Whether the entire certificate chain is included in the SSLServerAuthentication event. |
SSLNegotiatedCipher | Returns the negotiated ciphersuite. |
SSLNegotiatedCipherStrength | Returns the negotiated ciphersuite strength. |
SSLNegotiatedCipherSuite | Returns the negotiated ciphersuite. |
SSLNegotiatedKeyExchange | Returns the negotiated key exchange algorithm. |
SSLNegotiatedKeyExchangeStrength | Returns the negotiated key exchange algorithm strength. |
SSLNegotiatedProtocol | Returns the negotiated protocol version. |
SSLProvider | The name of the security provider to use. |
SSLSecurityFlags | Flags that control certificate verification. |
SSLServerCACerts | A newline separated list of CA certificate to use during SSL server certificate validation. |
TLS12SignatureAlgorithms | Defines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True. |
TLS12SupportedGroups | The supported groups for ECC. |
TLS13KeyShareGroups | The groups for which to pregenerate key shares. |
TLS13SignatureAlgorithms | The allowed certificate signature algorithms. |
TLS13SupportedGroups | The supported groups for (EC)DHE key exchange. |