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 0 (zero).

Use SSL

Options: True, False. Default: False.
If True, secure socket layer is used for this connection and all messages are encrypted.

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: True, False. Default: False
If True, SSL client mode will be enabled. Note that this is NOT the same as enabling client authentication: TLS client authentication is enabled by configuring one or more trusted certificates for the connection.

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: True, False. Default: False

If True, the stale connection recovery mode is enabled. Refer to Stale Connection Recovery for details.

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 replaceable if a new connection is established.

Initialise

The Initialise script is called whenever the communication point is started.

Log Connections

If True, establishing and dropping of all connections to the communication point are logged to the log file specified in the Connection Log File property.
Use of this logging facility slows the communication point down considerably. It is intended for debugging purposes and should not generally be used.

Log Data

If True, all data passed over the connections of the communication point is logged to the log file. This is potentially a lot of data.

Log Data As Hex

If True, the hexadecimal representation of the data is logged to the log file.
If False, the data is logged exactly as it is as it passes over the communication point connection.

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: None, Log Time. Default: Log Time

If set to Log Time , the timestamps will be logged with each event.

Receive

The Receive script is expected to read a message from the transport and populate the result message and return a True Boolean value. If no message can be received within a short time period (such as 5 seconds), the script should return a false value.

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 True to indicate that Rhapsody has successfully stored the message and that the remote system may be informed that it has been received successfully.

If the success global variable is False, the message was not received successfully and the remote system should be informed.

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 0 (zero).

Use SSL

Options: True, False. Default: False
If True, secure socket layer will be used for this connection and all messages will be encrypted.

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: True, False. Default: False
If True, SSL client mode will be enabled. Note that this is NOT the same as enabling client authentication: TLS client authentication is enabled by configuring one or more trusted certificates for the connection.

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.

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: True, False. Default: False

If True, the stale connection recovery mode is enabled. Refer to Stale Connection Recovery for details.

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 True, establishing and dropping of all connections to the communication point are logged to the log file specified in the Connection Log File property.
Use of this logging facility slows the communication point down considerably. It is intended for debugging purposes and should not generally be used.

Log Data

If True, all data passed over the connections of the communication point is logged to the log file. This is potentially a lot of data.

Log Data As Hex

If True, the hexadecimal representation of the data is logged to the log file.
If False, the data is logged exactly as it is as it passes over the communication point connection.

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: None, Log Time. Default: Log Time
If set to Log Time, the timestamps will be logged with each event.

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