3.3.1 WebSocket Headers

Topic Version1Published10/31/2016
For StandardETP v1.1

The majority of information exchanged in ETP occurs through Avro messages. However, a few things are transferred by HTTP headers. The initial WebSocket connection request makes use of the following headers:

  • The Sec-WebSocket-Protocol header is defined in RFC-6455 and MUST be used to establish the use of the Energistics Transfer Protocol for this WebSocket connection. The value MUST be equal to the string "energistics-tp".
  • In addition to the main protocol identifier, the connection request MAY supply a header indicating the encoding to be used for the life of the connection. The name of the header is the string "etp-encoding" and the value may be either the string "binary" or the string "json". If the header is not present, the server MUST assume binary encoding.
  • The client MAY supply a header named etp-session. The value of this header MUST be the UUID of a previously established session with this server. If the session stills exists on the server, then the server will reconnect the session according to the behavior described in the section on SessionSurvivability in the Core protocol.

Currently the Web browser version of the WebSocket API does not support passing any custom headers (the Sec-WebSocket-Protocol header is supported by the API, but nothing else). For this reason, to support HTML5 (i.e., browser-based) clients, servers MUST also examine the HTTP request variables (i.e., query string) for any of the etp-xxxxx values and, if present, use them. If both are present, the server SHOULD ignore the HTTP headers and use the query string.