The APC Handler Class
The APC handler class of each APC inherits from the superclass
- CL_APC_WSP_EXT_STATELESS_BASE without using a sub-protocol
- CL_APC_WSP_EXT_STATELESS_PCP_B using the Push Channel Protocol (PCP)
Both superclasses contain the abstract interface methods ON_START and ON_MESSAGE that have to be redefined application-specific.
- ON_START
This method is executed by the APC framework in the APC handler when the Push Channel is started. Here you can implement initial actions that are to be performed at this point of time. For example, you can trigger the binding with an AMC here. The method can also stay empty.
- ON_MESSAGE
This method is executed by the APC framework in the APC handler when the Push Channel receives a WebSocket message. Here you have to implement resp. call all reactions to the message. For this purpose, input parameters are available that reference objects for the message, its context and the message manager. For example, you can send a message as reply.
- Using the APC without sub-protocol, you can read text messages and binary message content from received message objects and write them to messages that are to be sent.
- Using an APC with the Push Channel Protocol (PCP), the content of received messages can be deserialized to ABAP data and ABAP data can be serialized to message objects that are to be sent.
Optionally, you can implement other interface methods like ON_ACCEPT, ON_CLOSE and ON_ERROR to react to the corresponding events. Particularly, in ON_ACCEPT you can decide wether a WebSocket connection is to be opened or not.
Example
As an example see the APC handler class CL_APC_WS_EXT_DEMO_APC for the ABAP Push Channel DEMO_APC or CL_APC_WSP_EXT_DEMO_APC_PCPfor the ABAP Push Channel DEMO_APC_PCP.