The JavaScript TCP Server communication point is used to create a communications protocol through JavaScript. These communication points must implement four scripts used to communicate with the underlying transport. The JavaScript TCP Server communication point allows four scripts to be configured by the user to control the TCP connection. The connection itself is established and managed by the Rhapsody framework, however, the custom JavaScript is responsible for performing the reading and writing to the connection itself.
The four scripts are as follows:
- init - runs when a new connection is established. This is to allow any initialization or login sequence to be performed.
- send - this script is used to send a message over the connection.
- receive - this script is used to read a message from the connection.
- done - this script is used to indicate that a received message has been successfully stored by the communication point framework.
Refer to Global Variables for details on the global objects associated with these scripts.
Supported Operational Modes: All
In order to make this server communication point more tolerant to connection failures from clients or misconfigured clients, we recommend that its connection retry count be set to infinite. Refer to Connection Retries for details.
Input Mode Properties
Property |
Description |
---|---|
Local Port |
Port number to which you want to bind the local socket. |
Local Address |
Hostname or IP address of the local interface to which you want to bind the socket connection (all interfaces if blank). |
Listen Backlog |
The maximum number of connections that the OS kernel queues for the underlying TCP socket. TCP connections which have been established after completing a three-way TCP handshake are queued on this queue until a Rhapsody server communication point accept them A Rhapsody communication point can only accept a number of connections equal to its maximum configured connections. Any additional connections will remain on the kernel queue and will not be processed by Rhapsody - client applications will be unaware that their connection is not being processed and may continue to send data. As such, it is imperative that Rhapsody TCP server communication points have the number of connections configured to adequately service all client connections. The listen backlog parameter is only intended to serve as a temporary queue for client connections prior to being accepted by the server communication point. The specified backlog parameter must be a positive number greater than |
Use SSL |
Options: It is strongly recommended that SSL be enabled for JavaScript TCP Server communication points. Refer to TLS/SSL Support in Rhapsody for details. |
SSL Protocol Mode |
Refer to SSL Protocol Versions for details. |
SSL Cipher Suites |
Refer to SSL Cipher Suites for details. |
Use SSL Client Mode |
Options: |
Secure Keys |
The list of private keys to choose from when selecting a private key to use in the communication with the client. If the Secure Keys configuration property is not configured with the SSL server's private key, then this SSL server operates in anonymous server authentication mode, and so enables the appropriate anonymous cipher suites. However, it is highly recommend that the server's private key always be provided here to allow server authentication to be performed. If the server does not have a private key, then one can be generated from Rhapsody's certificate manager. Refer to Server Authentication for details. |
Trusted Certificates |
Identifies the trusted certificates used at the non-Rhapsody end of the SSL connection. If it is configured with one or more certificates, then the SSL server requires client authentication as part of the SSL protocol negotiation, and will reject clients that do not present either the configured certificate, or a certificate directly or indirectly issued by the configured certificate. It is highly recommended that client authentication be enabled whenever possible. Refer to Client Authentication for details. |
Stale Connection Recovery |
Options: If This configuration property only takes effect if the Number of Connections for this communication point is set to |
Stale Connection Timeout | The idle timeout in seconds after which a connection is regarded as stale and so replaceable if a new connection is established. |
Initialise |
The Initialise script is called whenever the communication point is started. |
Log Connections |
If |
Log Data |
If |
Log Data As Hex |
If |
Connection Log File |
The full file name (path and file name) of the file on the server to log the information to. |
Extra Information |
Options: If set to |
Receive |
The Receive script is expected to read a message from the transport and populate the result message and return a |
Done receive |
The Done receive script is called once the message has been persisted into the Rhapsody database. The success global variable is set to If the success global variable is |
Output Mode Properties
Property |
Description |
---|---|
Local Port |
Port number to which you want to bind the local socket. |
Local Address |
Hostname or IP address of the local interface to which you want to bind the socket connection (all interfaces if blank). |
Listen Backlog |
The maximum number of connections that the OS kernel queues for the underlying TCP socket. TCP connections which have been established after completing a three-way TCP handshake are queued on this queue until a Rhapsody server communication point accept them A Rhapsody communication point can only accept a number of connections equal to its maximum configured connections. Any additional connections will remain on the kernel queue and will not be processed by Rhapsody - client applications will be unaware that their connection is not being processed and may continue to send data. As such, it is imperative that Rhapsody TCP server communication points have the number of connections configured to adequately service all client connections. The listen backlog parameter is only intended to serve as a temporary queue for client connections prior to being accepted by the server communication point. The specified backlog parameter must be a positive number greater than |
Use SSL |
Options: It is strongly recommended that SSL be enabled for JavaScript TCP Server communication points. Refer to TLS/SSL Support in Rhapsody for details. |
SSL Protocol Mode |
Refer to SSL Protocol Versions for details. |
SSL Cipher Suites |
Refer to SSL Cipher Suites for details. |
Use SSL Client Mode |
Options: |
Secure Keys |
The list of private keys to choose from when selecting a private key to use in the communication with the client. If the Secure Keys configuration property is not configured with the SSL server's private key, then this SSL server operates in anonymous server authentication mode, and so enables the appropriate anonymous cipher suites. However, it is highly recommended that the server's private key always be provided here to allow server authentication to be performed. If the server does not have a private key, then one can be generated from Rhapsody's certificate manager. |
Trusted Certificates |
Identifies the trusted certificates used at the non-Rhapsody end of the SSL connection. If it is configured with one or more certificates, then the SSL server requires client authentication as part of the SSL protocol negotiation, and will reject clients that do not present either the configured certificate, or a certificate directly or indirectly issued by the configured certificate. It is highly recommended that client authentication be enabled whenever possible. Refer to Client Authentication for details. |
Stale Connection Recovery |
Options: If This configuration property only takes effect if the Number of Connections for this communication point is set to 1. |
Stale Connection Timeout | The idle timeout in seconds after which a connection is regarded as stale and so able to be replaced if a new connection is established. |
Initialise |
The Initialise script is called whenever the communication point is started. |
Log Connections |
If |
Log Data |
If |
Log Data As Hex |
If |
Connection Log File |
The full file name (path and file name) of the file on the server to log the information to. |
Extra Information |
Options: |
Send |
The Send script is called whenever there is a message waiting to be sent via the communication point. The message to be sent is passed to the script in the global variable message. |
Bidirectional, In->Out and Out->In Mode
The configuration properties for the JavaScript TCP Server communication point in Bidirectional, In->Out and Out->In modes is a combination of the properties described above.
Refer to Out->In and In->Out Properties for general details on a communication point's In->Out and Out->In modes.
Connection Monitoring
Refer to Connection Monitoring or details.
Additional Information
- Refer to JavaScript Object Reference for details on JavaScript and the objects that Rhapsody exposes.
- Refer to Shared JavaScript Libraries for details on how to manage shared JavaScript libraries.