Skip to content

Commit ce58e62

Browse files
committed
Update
1 parent 59e2b92 commit ce58e62

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ using [@sap/cds](https://www.npmjs.com/package/@sap/cds) (CDS Node.js).
5151
- [Connect & Disconnect](#connect--disconnect)
5252
- [Server Client Service](#server-client-service)
5353
- [Approuter](#approuter)
54+
- [Paths](#paths)
5455
- [Operations](#operations)
5556
- [Operation Results](#operation-results)
5657
- [Unbound Operations](#unbound-operations)
@@ -1701,10 +1702,12 @@ UI websocket paths need to be properly routed to the backend service. The follow
17011702
- To access UI with and without Approuter (local development), the backend service can adjust for the Approuter path prefix in the `upgrade` server request.
17021703
- **Example:** (Approuter routes `/ws/chat` to backend service path `/chat`)
17031704
```js
1704-
server.on("upgrade", function (req) {
1705-
if (req.url.startsWith("/ws")) {
1706-
req.url = req.url.replace("/ws", "");
1707-
}
1705+
cds.on("listening", async ({ server, url }) => {
1706+
server.on("upgrade", function (req) {
1707+
if (req.url.startsWith("/ws")) {
1708+
req.url = req.url.replace("/ws", "");
1709+
}
1710+
});
17081711
});
17091712
```
17101713

test/_env/app/todo/webapp/Component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ sap.ui.define(
1212

1313
constructor: function () {
1414
AppComponent.prototype.constructor.apply(this, arguments);
15-
this.ws("/ws/todo");
15+
this.websocket("/ws/todo");
1616
},
1717

18-
ws: function (sUrl, sName = "main") {
18+
websocket: function (sUrl, sName = "main") {
1919
window.websockets ??= {};
2020
window.websockets[sName] = {
2121
_ws: undefined,

0 commit comments

Comments
 (0)