IPWorks WebSockets 2020 macOS Edition

Questions / Feedback?

WebSocketProxy Module

Properties   Methods   Events   Configuration Settings   Errors  

The WebSocketProxy component is used to forward traffic received on a WebSocket to another destination.

Syntax

nsoftware.IPWorksWS.Websocketproxy

Remarks

The WebSocketProxy class provides a simple way to accept a WebSocket connection and forward the incoming data to a separate destination host.

The WebSocketProxy class is a server that accepts incoming WebSocket connections and will establish an outgoing connection to the specified forward host and forward data it receives onto the final destination. For instance, take this diagram:

Client ---WebSocket protocol---> WebSocketProxy ---plain TCP---> Forward Host

In this example the Client establishes a WebSocket connection to the WebSocketProxy component. The WebSocketProxy class then establishes a separate standard TCP connection to Forward Host. The Client can then communicate with the Forward Host and data will be passed through WebSocketProxy.

To begin using the class first specify a valid value for LocalPort. This is the port on which incoming connections will be accepted. Specify values for DefaultForwardHost and DefaultForwardPort. This is the destination to which the data will be forwarded. Note that you may override these values on a per connection basis if desired when the client connects.

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). You may also set the ForwardHost and ForwardPort event parameters to override the default values.

Once the connection is established all data received on the connection will automatically be forwarded to the forward host. Any data received from the forward host will be sent back to the client. The client is now able to freely communicate with the forward host.

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 module with short descriptions. Click on the links for further details.

ConnectionBacklogThe maximum number of pending connections maintained by the TCP/IP subsystem.
ConnectionsA collection of currently connected WebSocket clients.
DefaultForwardHostThe default address of the host to which data will be forwarded.
DefaultForwardPortThe default port of the host to which data will be forwarded.
DefaultTimeoutAn initial timeout value to be used by incoming connections.
FirewallA set of properties related to firewall access.
ListeningIf True, the component accepts incoming connections on LocalPort.
LocalHostThe name of the local host or user-assigned IP interface through which connections are initiated or accepted.
LocalPortThe TCP port in the local host where the component listens.
SSLAuthenticateClientsIf true, the server asks the client(s) for a certificate.
SSLCertEncodedThe certificate (PEM/base64 encoded).
SSLCertStoreThe name of the certificate store for the client certificate.
SSLCertStorePasswordIf 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.
SSLCertStoreTypeThe type of certificate store for this certificate.
SSLCertSubjectThe subject of the certificate used for client authentication.
UseSSLDetermines if SSL is negotiated with incoming connections.

Method List


The following is the full list of the methods of the module with short descriptions. Click on the links for further details.

ConfigSets or retrieves a configuration setting.
DisconnectDisconnect the specified client.
DoEventsProcesses events from the internal message queue.
ShutdownShuts down the server.

Event List


The following is the full list of the events fired by the module with short descriptions. Click on the links for further details.

ConnectedFired when a WebSocket is successfully opened.
ConnectionRequestFired when a request for connection comes from a remote host.
DataInFired when data is received.
DisconnectedFired when a WebSocket connection is disconnected.
ErrorInformation about errors during data delivery.
LogFires once for each log message.
SSLClientAuthenticationFired when the client presents its credentials to the server.
SSLConnectionRequestFires when an SSL connection is requested.
SSLStatusShows the progress of the secure connection.
WebSocketOpenRequestFired when a client attempts to open a WebSocket.

Configuration Settings


The following is a list of configuration settings for the module with short descriptions. Click on the links for further details.

BufferMessageIndicates whether or not the entire message is buffered before firing the DataIn event.
DisconnectStatusCodeSpecifies the status code when closing a connection.
DisconnectStatusDescriptionSpecifies the message associated with the disconnect status code.
MaxFrameSizeSpecifies the maximum size of the outgoing message in bytes before fragmentation occurs.
MessageLength[ConnectionId]The length of the message (in bytes) when sending asynchronously.
WaitForCloseResponseDetermines whether or not the component will forcibly close a connection.
AllowedClientsA comma-separated list of host names or IP addresses that can access the component.
AllowedClientsA comma-separated list of host names or IP addresses that can access the component.
BindExclusivelyWhether or not the component considers a local port reserved for exclusive use.
BindExclusivelyWhether or not the component considers a local port reserved for exclusive use.
DefaultConnectionTimeoutThe inactivity timeout applied to the SSL handshake.
DefaultConnectionTimeoutThe inactivity timeout applied to the SSL handshake.
InBufferSizeThe size in bytes of the incoming queue of the socket.
InBufferSizeThe size in bytes of the incoming queue of the socket.
KeepAliveIntervalThe retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received.
KeepAliveIntervalThe retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received.
KeepAliveTimeThe inactivity time in milliseconds before a TCP keep-alive packet is sent.
KeepAliveTimeThe inactivity time in milliseconds before a TCP keep-alive packet is sent.
MaxConnectionsThe maximum number of connections available.
MaxConnectionsThe maximum number of connections available.
OutBufferSizeThe size in bytes of the outgoing queue of the socket.
OutBufferSizeThe size in bytes of the outgoing queue of the socket.
TcpNoDelayWhether or not to delay when sending packets.
TcpNoDelayWhether or not to delay when sending packets.
UseIPv6Whether to use IPv6.
UseIPv6Whether to use IPv6.
LogSSLPacketsControls whether SSL packets are logged when using the internal security API.
LogSSLPacketsControls whether SSL packets are logged when using the internal security API.
OpenSSLCADirThe path to a directory containing CA certificates.
OpenSSLCADirThe path to a directory containing CA certificates.
OpenSSLCAFileName of the file containing the list of CA's trusted by your application.
OpenSSLCAFileName of the file containing the list of CA's trusted by your application.
OpenSSLCipherListA string that controls the ciphers to be used by SSL.
OpenSSLCipherListA string that controls the ciphers to be used by SSL.
OpenSSLPrngSeedDataThe data to seed the pseudo random number generator (PRNG).
OpenSSLPrngSeedDataThe data to seed the pseudo random number generator (PRNG).
ReuseSSLSessionDetermines if the SSL session is reused.
ReuseSSLSessionDetermines if the SSL session is reused.
SSLCACertsA newline separated list of CA certificate to use during SSL client authentication.
SSLCACertsA newline separated list of CA certificate to use during SSL client authentication.
SSLCheckCRLWhether to check the Certificate Revocation List for the server certificate.
SSLCheckCRLWhether to check the Certificate Revocation List for the server certificate.
SSLCipherStrengthThe minimum cipher strength used for bulk encryption.
SSLCipherStrengthThe minimum cipher strength used for bulk encryption.
SSLEnabledCipherSuitesThe cipher suite to be used in an SSL negotiation.
SSLEnabledCipherSuitesThe cipher suite to be used in an SSL negotiation.
SSLEnabledProtocolsUsed to enable/disable the supported security protocols.
SSLEnabledProtocolsUsed to enable/disable the supported security protocols.
SSLEnableRenegotiationWhether the renegotiation_info SSL extension is supported.
SSLEnableRenegotiationWhether the renegotiation_info SSL extension is supported.
SSLIncludeCertChainWhether the entire certificate chain is included in the SSLServerAuthentication event.
SSLIncludeCertChainWhether the entire certificate chain is included in the SSLServerAuthentication event.
SSLProviderThe name of the security provider to use.
SSLProviderThe name of the security provider to use.
SSLSecurityFlagsFlags that control certificate verification.
SSLSecurityFlagsFlags that control certificate verification.
TLS12SignatureAlgorithmsDefines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True.
TLS12SignatureAlgorithmsDefines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True.
TLS12SupportedGroupsThe supported groups for ECC.
TLS12SupportedGroupsThe supported groups for ECC.
TLS13KeyShareGroupsThe groups for which to pregenerate key shares.
TLS13KeyShareGroupsThe groups for which to pregenerate key shares.
TLS13SignatureAlgorithmsThe allowed certificate signature algorithms.
TLS13SignatureAlgorithmsThe allowed certificate signature algorithms.
TLS13SupportedGroupsThe supported groups for (EC)DHE key exchange.
TLS13SupportedGroupsThe supported groups for (EC)DHE key exchange.

Copyright (c) 2021 /n software inc. - All rights reserved.
IPWorks WebSockets 2020 macOS Edition - Version 20.0 [Build 7941]