IP*Works! WS V9 - Online Help
IP*Works! WS V9
Questions / Feedback?

WSServer Class

Properties   Methods   Events   Configuration Settings   Errors  

The WSServer component is used to create a WebSocket server.

Class Name

IPWorksWS_WSServer

Procedural Interface

 ipworksws_wsserver_open();
 ipworksws_wsserver_close($res);
 ipworksws_wsserver_register_callback($res, $id, $function);
 ipworksws_wsserver_get_last_error($res);
 ipworksws_wsserver_get_last_error_code($res);
 ipworksws_wsserver_set($res, $id, $index, $value);
 ipworksws_wsserver_get($res, $id, $index);
 ipworksws_wsserver_do_config($res, $configurationstring);
 ipworksws_wsserver_do_disconnect($res, $connectionid);
 ipworksws_wsserver_do_doevents($res);
 ipworksws_wsserver_do_interrupt($res, $connectionid);
 ipworksws_wsserver_do_send($res, $connectionid, $data);
 ipworksws_wsserver_do_sendfile($res, $connectionid, $filename);
 ipworksws_wsserver_do_sendtext($res, $connectionid, $text);
 ipworksws_wsserver_do_shutdown($res);

Remarks

The WSServer class provides an easy way to accept connections from WebSocket clients and transfer data.

The WSServer class 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 class 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 WSConnectionDataToSend.

Property List


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

ConnectionBacklogThe maximum number of pending connections maintained by the TCP/IP subsystem.
WSConnectionCountThe number of records in the WSConnection arrays.
WSConnectionAcceptDataSetting this property to False, temporarily disables data reception (and the DataIn event) on the connection.
WSConnectionBytesSentThis property shows how many bytes were sent after the last assignment to DataToSend .
WSConnectionConnectedThis property is used to disconnect individual connections and/or show their status.
WSConnectionConnectionIdThis property contains an identifier generated by the component to identify each connection.
WSConnectionDataFormatThe format of the data being sent.
WSConnectionDataToSendThis property contains a string of data to be sent to the remote host.
WSConnectionHostThe Host header value of the connected client.
WSConnectionLocalAddressThis property shows the IP address of the interface through which the connection is passing.
WSConnectionOriginThe Origin header value of the connected client.
WSConnectionRemoteHostThis property shows the IP address of the connected client.
WSConnectionRemotePortThis property shows the port of the connected client.
WSConnectionRequestHeadersThe HTTP headers sent by the client in the initial WebSocket connection request.
WSConnectionRequestURIThe requested URI sent by the client in the initial WebSocket connection request.
WSConnectionSubProtocolsThe subprotocols (application-level protocols layered over the WebSocket Protocol) sent by the client in the initial WebSocket connection request.
WSConnectionTimeoutA timeout for the component.
DefaultTimeoutAn initial timeout value to be used by incoming connections.
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 class 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.
InterruptInterrupts a synchronous send to the remote host.
SendSends binary data to the client.
SendFileSend file to the remote host.
SendTextSends text data to the client.
ShutdownShuts down the server.

Event List


The following is the full list of the events fired by the class 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.
ReadyToSendFired when the component is ready to send data.
SSLClientAuthenticationFired when the client presents its credentials to the server.
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 class with short descriptions. Click on the links for further details.

WaitForCloseResponseDetermines whether or not the component will forcibly close a connection.
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.
BindExclusivelyWhether or not the component considers a local port reserved for exclusive use.
InBufferSizeThe size in bytes of the incoming queue of the socket.
MaxConnectionsThe maximum number of connections available.
OutBufferSizeThe size in bytes of the outgoing queue of the socket.
KeepAliveTimeThe inactivity time in milliseconds before a TCP keep-alive packet is sent.
KeepAliveIntervalThe retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received.
RecordLength[ConnectionId]The length of received data records.
TcpNoDelayWhether or not to delay when sending packets.
ReuseSSLSessionDetermines if the SSL session is reused.
SSLCipherStrengthThe minimum cipher strength used for bulk encryption.
SSLEnabledProtocolsUsed to enable/disable the supported security protocols.
SSLProviderThe name of the security provider to use.
SSLSecurityFlagsFlags that control certificate verification.
OpenSSLCADirThe path to a directory containing CA certificates.
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.
OpenSSLPrngSeedDataThe data to seed the pseudo random number generator (PRNG).
CodePageThe system code page used for Unicode to Multibyte translations.

 
 
Copyright (c) 2017 /n software inc. - All rights reserved.
Build 9.0.6240.0