Skip to Content

Websockets on HCP & Cloud Connector

Hello experts,

This question was already asked before here in the forum:

"created an UI5 App which uses a websocket connection to display Push Messages from the ABAP Backend. This workes fine, but now I moved the UI5 to the HANA Cloud Platform and the connection to the ABAP Backend is now realized with the Cloud Connector."

I understand that this capability was not supported by SAP Cloud Connector, but SAP just released a new version of Cloud Connector 2.12, as it can be seen on sap Note 2573250

https://launchpad.support.sap.com/#/notes/0002573250

This note claims that the new version supports that:

"WebSocket channel is not supported under a certain version of SCC for the channel SAP Cloud Platform to On-Premise. From Cloud Connector 2.12 the new feature is initiated."

I installed the new version of the Cloud connector and indeed there is a new option under the configuration of the exposed resources where we can expose the resource to websockets:

My Abap push channel is working well when I use the test tool on premise.

But when I try to open the websocket from SAP Cloud Platform (SAP WEB IDE), I got the following error:

"WebSocket connection to

'wss://webidecp-e23425u5k.dispatcher.eu2.hana.ondemand.com/destinations/AM1_HTTPS/sap/bc/apc/sap/zam_candy' failed: Error during WebSocket handshake: Unexpected response code: 501"

AM1_HTTPS is my destination to a virtual host in the cloud connector that uses the protocol HTTPS, has an HTTPS port and has the resource "/sap" is exposed. The 'websocket upgrade' is marked as shown on the image above.

I tried first using the following code to generate the URL: (I don't believe this is the correct way tho, as we are not informing the destination where the resource is exposed and Websocket upgraded)

jQuery.sap.require("sap.ui.core.ws.WebSocket");

var socket = new sap.ui.core.ws.WebSocket('/sap/bc/apc/sap/ztest');

But this generates the following WSS and error:

"WebSocket connection to 'wss://webidetesting0968589-e23425u5k.dispatcher.eu2.hana.ondemand.com/sap/bc/apc/sap/zam_candy' failed: Error during WebSocket handshake: Unexpected response code: 404"

Even using the new version I am not able to open the websocket on HCP.

I would appreciate any advice regarding this solution.

Thank you so much.

resource.png (8.8 kB)
apc.png (10.3 kB)
apc.png (10.3 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    May 30 at 07:11 AM

    Dear Ernani,

    my first request to get support for WebSockets dates to September 2015 when the Platform was called HCP. I was glad when finally the WebSockets support arrived in the Cloud Connector. Immediately I've tried my sample applicaiton that I've described in this post: ABAP Push / Messaging Channel and SAPUI5 Demo Application. Unfortunately I've experienced the same issues. So I reached out to my previous SAP contacts who directed me to Markus Tolksdorf. His answer was that the HTML5 runtime seems not to support WebSockets yet. The only option would be to create a Java App (Neo) or an app in one of the Cloud Foundry Buildpacks that does forward the data using WebSockets. Hope someone responsible for the HTML5 runtime and also the responsible for @sap/approuter might chime in here to provide an update.

    Best regards
    Gregor

    Add comment
    10|10000 characters needed characters exceeded

  • May 31 at 08:21 AM

    Hi Ernani,

    Gregor has already explained the current state: Cloud Connector does support WebSockets now, but this is not sufficient for your use case. For that HTML5 runtime needs to be enhanced to also make use of the new feature.

    Best regards,
    Markus

    Add comment
    10|10000 characters needed characters exceeded

    • Hello Markus, Thank you so much for your attention. I ended up testing the Websockets by publishing my app to ABAP system and running it from Fiori Lauchpad. Your help is much appreciated. Ernani

  • Jun 02 at 06:21 AM

    Dear Ernani,

    HTML5 Applications service supports WebSockets only on CF environment.
    You can read more about HTML5 Applications development in our official docs:
    1. HTML5 Applications Product Page
    2. WebSocket support

    Best Regards,
    Ari

    Add comment
    10|10000 characters needed characters exceeded

    • Hello Ari,

      That makes a lot of sense.

      I am using Neo environment for my developments. For my next project I will try through CF. For my current project I ended up testing the solution from Fiori Lauchpad, since the only validation that I needed was regarding the Websockets.

      Thank you so much for the detailed help.

      Ernani