You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -59,6 +60,7 @@ using [@sap/cds](https://www.npmjs.com/package/@sap/cds) (CDS Node.js).
59
60
-[Bound Operations](#bound-operations)
60
61
-[CRUD Operations](#crud-operations)
61
62
-[Examples](#examples)
63
+
-[Fiori (UI5)](#fiori-ui5)
62
64
-[Todo (UI5)](#todo-ui5)
63
65
-[Chat (HTML)](#chat-html)
64
66
-[Unit-Tests](#unit-tests)
@@ -1196,7 +1198,20 @@ To configure the PCP message format, the following annotations are available:
1196
1198
##### Fiori Side Effects
1197
1199
1198
1200
PCP format can be used to emit Fiori side effects via WebSocket events.
1199
-
To configure Fiori side effects in PCP format enabled service, the following annotations are available:
1201
+
1202
+
First OData V4 service metadata is extended for side effects to automatically connect to the corresponding websocket endpoint and channel:
1203
+
1204
+
```cds
1205
+
@Common : {
1206
+
WebSocketBaseURL : '/ws/fiori',
1207
+
WebSocketChannel #sideEffects: 'sideeffects'
1208
+
}
1209
+
service FioriService {
1210
+
...
1211
+
}
1212
+
```
1213
+
1214
+
Fiori side effects are configured in PCP format enabled service via the following annotations:
1200
1215
1201
1216
- **Event level**:
1202
1217
- `@websocket.pcp.sideEffect, @ws.pcp.sideEffect: Boolean`: Expose Fiori side effects in the PCP message
@@ -1206,57 +1221,63 @@ Example:
1206
1221
1207
1222
```cds
1208
1223
@ws.pcp.sideEffect
1209
-
@ws.pcp.channel: 'amc\://notification/notify'
1224
+
@ws.pcp.channel: 'sideeffects'
1210
1225
event sideEffect {
1211
1226
sideEffectSource: String;
1212
1227
}
1213
1228
```
1214
1229
1215
-
Side effects often are restricted to user-owned client connections only. Therefore, the annotation can be added to prevent broadcasting to all clients.
1230
+
Side effects are often restricted to user-owned client connections only. Therefore, the annotation `@ws.user` can be added to prevent broadcasting to all clients.
1216
1231
In addition, PCP Channel can be omitted, if the common annotation `@Common.WebSocketChannel` is defined on the service level.
1217
1232
1218
1233
Example:
1219
1234
1220
1235
```cds
1221
-
@ws.user
1222
-
@ws.pcp.sideEffect
1223
-
event sideEffect {
1236
+
@Common: {
1237
+
WebSocketBaseURL: '/ws/fiori',
1238
+
WebSocketChannel: 'sideeffects',
1239
+
}
1240
+
service FioriService {
1241
+
@ws.user
1242
+
@ws.pcp.sideEffect
1243
+
event sideEffect {
1224
1244
sideEffectSource: String;
1245
+
}
1246
+
}
1247
+
```
1248
+
1249
+
To consume side effects in Fiori Elements, an CDS entity can be annotated with side effects as follows:
1250
+
1251
+
Example:
1252
+
1253
+
```cds
1254
+
@Common.SideEffects #sideEffect: {
1255
+
SourceEvents : ['sideEffect'],
1256
+
TargetProperties: ['name']
1225
1257
}
1258
+
entity Header { ... }
1226
1259
```
1227
1260
1228
-
Emitting the event `sideEffect` via CDS emit, as follows:
1261
+
The event `sideEffect` is emitted on server side via CDS `emit`, as follows:
0 commit comments