cancel
Showing results for 
Search instead for 
Did you mean: 

Neo-Environment - Websockets via destinations - HTML5-Application

0 Kudos

Hello,

is it possible to establish a websocket connection through a destination?

Following Situation:
- HTML5-Application in consumer account uses a destination

- the destination points to a java backend deployed in a provider account

- the backend provides websocket endpoints and delivers data. That works fine if
a websocket connection is established to the backend directly

- if the connection is establised from the HTML5 Applicaion which uses the
destination - or if the url directly - http 404 is returned.

Does anyone kow if wss is blocked when using destinations in the neo environment?

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Thanks. We created a service endpoint which returns a wss base url using:
System.getenv("HC_ACCOUNT")
System.getenv("HC_APPPLICATION")
...
...
etc.

Ivan-Mirisola
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Robert,

I don't think this would be possible. SCP's Destination API would allow you to "construct" the ws URL in Java or NodeJS. However, I don't think this would work the same in a HTML5 application directly (i.e.: using the routes in the neo-app.json file).

However, if you make the ws URL available via an service call, than you could potentially make it available to your HTML5 application via a model instance of the service.

The following example:

https://openui5.blogspot.com/2014/01/simple-chat-server-example-using-ui5.html

It uses the JavaScript class sap.ui.core.ws.WebSocket present in the UI5 to create the WebSocket object. However, it needs to pass as parameter the WS URL. This is not the same as using it from within the routes in an UI5 app.

There is also the Destination REST API, but this is not to be used inside a UI5 application because it requires an OAuth2 token (which is not safe to be retrieved via UI5).

Best regards,
Ivan