15. ProtocolsΒΆ

In AMPS, Protocols define the format of the commands that clients use to communicate with the server.

AMPS offers a range of preconfigured protocols. The most commonly-used protocols are:

Protocol Description
amps Standard protocol for AMPS clients
websocket Standard protocol for websocket connections using the AMPS Javascript library

The Protocols element configures options for a given protocol. The element is a container for one or more Protocol elements. Each Protocol is a combination of a Module, that defines the basic protocol, and a set of options to configure the behavior of that basic protocol.

Many installations of AMPS have no need to configure a Protocols block.

Element Description
Name

The name to use for the customized Protocol. This name is used in the Transport element to refer to the customized Protocol.

There is no default for this value. 60East recommends that the Name of the customized Protocol contain the name of the Module. For example, a customized protocol that adjusts the behavior of the websocket protocol might be named websocket-custom.

Module

This element defines the protocol module to customize. The Module must be the name of a protocol module loaded into AMPS.

By default, AMPS loads the following protocols:

Protocol Name Description
amps

Standard AMPS messaging, using compact headers in JSON format.

AMPS accepts json as a synonym for amps in a protocol declaration.

fix-session FIX session protocol, for use with systems that publish FIX messages using this format.
websocket Websocket protocol, using JSON format headers.
Legacy protocols  
fix Standard AMPS messaging, using headers in FIX format.
nvfix Standard AMPS messaging, using headers in NVFIX format.
soap Standard AMPS messaging, using headers in SOAP format.
xml Standard AMPS messaging, using headers in XML format.

Table 15.1: Protocol Parameters

The websocket protocol accepts the following additional configuration options:

Element Description
WWWAuthenticate

The type of authentication used for this protocol. This specifies how the connection will receive credentials from the connection.

The websocket protocol accepts two options for this element:

Option Description
Negotiate Use the “negotiate” scheme for HTTP authentication.
Basic Use basic authentication. When basic authentication is specified, the Realm must also be set. The syntax for setting the realm value is Realm=<name of realm>

For example, to use basic authentication and set the realm to a value of HTTP Special, you would use the following WWWAuthenticate element.

<WWWAuthenticate>Basic realm="HTTP Special"</WWWAuthenticate>

TrustedAdmin

Specify whether connections that use this protocol should accept connections from clients that have successfully authenticated to the administrative interface.

Default: false

HttpHeader

Specify that the server will return the custom header specified in response to a websocket request. A protocol of websocket type can have any number of these elements configured, and AMPS will return all of the headers defined.

There is no default for this element.

Table 15.2: Websocket Transport Parameters

<AMPSConfig>

   ...
   <Protocols>
     <Protocol>
       <Name>websocket-portal</Name>
       <Module>websocket</Module>
       <WWWAuthenticate>Basic realm="AMPS Admin"</WWWAuthenticate>
       <TrustedAdmin>enabled</TrustedAdmin>
     </Protocol>
   </Protocols>

 </AMPSConfig>

Example 15.1: Websockets Protocol Configuration Example