Configuring WebSocket endpoints

Overview

WebSockets TA is available since FIXEdge Java 1.10.3 version.

The WebSocket is a bidirectional protocol providing full-duplex communication channels over a single TCP connection. The WebSocket protocol makes the interaction between a browser and a web server possible, facilitating real-time data transfer from and to the server. This is possible by providing a standardized way for the server to send content to the browser without being solicited by the client, and allowing for messages to be passed back and forth while keeping the connection open. After closing the connection by either the client or server, the connection is terminated from both ends.

The WebSocket protocol specification defines ws:// and wss:// as two new URI schemes that are used for unencrypted and encrypted connections, respectively. Apart from the scheme name, the rest of the URI components are defined to use URI generic syntax.

WebSocket endpoints provide FIXEdge Java clients with the ability to establish a connection between the server-acceptor and client-initiator and then send and receive data from/to them. During start-up, FIXEdge Java initiates the Jetty server and endpoints defined in the websocket-adaptor.properties file: WebSocketServlets for acceptors and WebSocketClients for initiators. To add a new WebSocket endpoint to the websocket-adaptor.properties file, its configuration must be defined and its name must be added to the websocket.clients list.

Configuration properties

The WebSockets transport adaptor is configured by means of the following properties:

NameDescriptionRequiredDefault value

Common adapter properties

websocket.clients

A comma-delimited list of WebSocket endpoints. A separate configuration section for each listed client should be specified.Y

Connection properties

websocket.server.Enable

This boolean property defines whether the WebSocket server must be enabled.

N

false

websocket.server.Port

This property defines the port of the WebSocket server.

Y


websocket.server.IdleTimeout

This property defines the time in milliseconds that WebSocket may be idle before closing.

Y


websocket.server.QueuedThreadPool

This property defines the number of working threads for the WebSocket server.N250

websocket.server.SslKeystorePath

This property defines the file or URL of the SSL keystore.

Y


websocket.server.SslKeystorePassword

This property defines the password for the SSL keystore.

Y


Acceptor properties

websocket.acceptor.[acceptor_name].Password

This property defines the password to establish a connection with the acceptor.

Y


websocket.acceptor.[acceptor_name].ConverterBeanName

This property defines the bean name of implemented converter for processing messages.

N


websocket.acceptor.[acceptor_name].DictionaryId

This property defines the ID of the standard or custom dictionary for the messages converter.

Y if the ConverterBeanName property is defined


websocket.acceptor.[acceptor_name].startOnLoad

This property defines whether a WebSocket endpoint must be started during FIXEdge Java server initialization.Ntrue

Initiator properties

websocket.initiator.[initiator_name].Host

This property defines the host to connect to the acceptor server.

Y


websocket.initiator.[initiator_name].Port

This property defines the port to connect to the acceptor server.

Y


websocket.initiator.[initiator_name].Target

This property defines the name of the acceptor.

Y


websocket.initiator.[initiator_name].Password

This property defines the password of the acceptor.

Y


websocket.initiator.[initiator_name].ConverterBeanName

This property defines the bean name of implemented converter for processing messages.

N


websocket.initiator.[initiator_name].DictionaryId

This property defines the ID of the standard or custom dictionary for the messages converter.

Y if the ConverterBeanName property is defined


websocket.initiator.[initiator_name].IdleTimeout

This property defines the time in milliseconds before the connection will be closed by the container if it is inactive.

N

60000

websocket.initiator.[initiator_name].ConnectTimeout

This property defines the maximum time in milliseconds to wait for the connection to be established.

N

10000

websocket.initiator.[initiator_name].startOnLoad

This property defines whether a WebSocket endpoint must be started during FIXEdge Java server initialization.

N

true

WebSockets TA also provides the ability to perform FIX-to-JSON and JSON-to-FIX message conversion. To enable the JSON converter for WebSocket TA the converter.dictionary.json.init property must be set to 'true' in the msg-converter.properties file.

Configuration sample

websocket-adaptor.properties
websocket.server.Enable = true
websocket.server.Port = 8282
websocket.server.IdleTimeout = 3600000
websocket.server.QueuedThreadPool = 400
websocket.server.SslKeystorePath = classpath:/ssl/keystore.jks
websocket.server.SslKeystorePassword = rest

websocket.clients = acceptor1, initiator1

websocket.acceptor.acceptor1.Password = pass
websocket.acceptor.acceptor1.ConverterBeanName = jsonConverter
websocket.acceptor.acceptor1.DictionaryId = FIX44
websocket.acceptor.acceptor1.startOnload = false

websocket.initiator.initiator1.Host = localhost
websocket.initiator.initiator1.Port = 8282
websocket.initiator.initiator1.Target = acceptor1
websocket.initiator.initiator1.Password = pass
websocket.initiator.initiator1.ConverterBeanName = jsonConverter
websocket.initiator.initiator1.DictionaryId = FIX44
websocket.initiator.initiator1.IdleTimeout = 3600000
websocket.initiator.initiator1.ConnectTimeout = 60000
websocket.initiator.initiator1.startOnload = true