The Push Channel Protocol is a message based protocol, which is used in context of ABAP Channels, i.e. ABAP Messaging Channels and ABAP Push Channels. The message structure is very similar to a simple HTTP message (see RFC2616) without having the start-line (request-line, response-line) entry. In other words the PCP messages consist of (header) fields and a plain body which is separated by line feeds (LF, i.e. \n – 0x0A (hexadecimal) – 10 (decimal)). A field entry contains name-value pair separated by “:” character, i.e. <name>:<value>. The names and values are in UTF-8 characters and case-sensitive. The names and values should not contain the special characters LF, “:” and “\”. In that case the special characters must be escaped with the escape character “\” whereas LF is replaced by “\n”. Each field entry, i.e. <name>:<value>, is terminated by a line feed. The last field entry is completed with double LF, i.e. LFLF, independently of the existence of a body. In case of the existence of a body this content is appended after the double LFs. The body contains only UTF8 characters. A body in binary is encoded in Base64 format. Additionally field name or values must not contain leading or trailing spaces, i.e. white spaces. The field names starting with the prefix “pcp-” are reserved for PCP library and must not be used by application.
For the usage of the PCP protocol in context of ABAP Push Channel, i.e. the WebSocket support in ABAP Application Server, the WebSocket subprotocol “v10.pcp.sp.com”, i.e. version 1.0 of the PCP protocol, is to be used.
Augmented Backus-Naur Form (BNF)
A Push Channel Protocol (PCP) message can be more formally described using the Backus-Naur Form (BNF) grammar used in HTTP/1.1 RFC 2616. Figure 1 shows the structure of a PCP message.
Figure 1: BNF grammer of Push Channel Protocol message structure
The WebSocket log of a WebSocket connection to an ABAP Push Channel application using subprotocol “v10.pcp.sap.com” will show following records, when the client sends a PCP message with two fields and a body and the following values.
- Field 1 consisting of field name “field1” and field value “value1”
- Field 2 consisting of field name “field2” and field value “field2”
- A body containing the text “this is the body !”
In Chrome developer tools will show the following log entries:
with the content:
In this example the APC application returns the received message including the additional field with the field name “counter” and the field value “1” back:
with the content:
There exist up to now the following libraries for different use-cases:
- In ABAP Application Server and in the context of ABAP Channels the class CL_AC_MESSAGE_TYPE_PCP and interface IF_AC_MESSAGE_TYPE_PCP PCP provide the necessary APIs. Furthermore the PCP message type is an inbuilt message type in in ABAP Messaging Channels and in ABAP Push Channels as WebSocket subprotocol “v10.pcp.sap.com”.