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

6 Answers

  • Best Answer
    Posted on Oct 21, 2019 at 09:54 AM

    Hi Ernani Ribeiro ,

    as Gregor Wolf mentioned, I have filed a now resolved incident and the CF Approuter supports this from 6.5.0 (websocket without subprotocol with onpremise destinations) resp. 6.5.1 (also support for subprotocols like PCP used by APC/SAPUI5) on.

    Regards,

    Wolfgang

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on May 30, 2019 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

  • Posted on May 31, 2019 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

  • Posted on Jun 02, 2019 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

  • Posted on Feb 20 at 08:24 AM

    Hi All,

    As of Feb 2020 is it still the case that websockets are not supported in HTML5 on SAP Cloud NEO?

    The scenario I am looking at is push notifications from an ABAP backend to Fiori Launchpad running on NEO.

    I know Fiori Launchpad can pull (via periodic polling) via the notifications odata service on the backend, but was hoping to try true push channel.

    Thanks,

    Brendan

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 23 at 09:13 AM

    Dear Brendan,

    My answer above still apply.

    Best Regards,

    Ari

    Add comment
    10|10000 characters needed characters exceeded