Skip to content

Commit f796c1d

Browse files
committed
Docs
1 parent c93c786 commit f796c1d

File tree

3 files changed

+51
-46
lines changed

3 files changed

+51
-46
lines changed

README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ The CDS websocket server supports the following two websocket implementations:
129129

130130
- [WebSocket Standard](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API) (via Node.js [ws](https://www.npmjs.com/package/ws) package): `cds.websocket.kind: "ws"` **(default)**
131131
- [Socket.IO](https://socket.io): `cds.websocket.kind: "socket.io"`
132-
- Custom Server: A custom websocket server implementation can be provided via `cds.websocket.impl`
132+
- **Custom Server**: A custom websocket server implementation can be provided via a path relative to the project root
133+
with the configuration `cds.websocket.impl` (e.g. `cds.websocket.impl: './server/xyz.js'`).
133134

134135
The server implementation abstracts from the concrete websocket implementation. The websocket client still needs to be implemented websocket implementation specific.
135136

@@ -521,14 +522,15 @@ To configure the PCP message format the following annotations are available:
521522
522523
#### Custom Format
523524
524-
A custom websocket format implementation can be provided via a relative path in `@websocket.format` resp. `@ws.format` annotation.
525+
A custom websocket format implementation can be provided via a path relative to the project root
526+
in `@websocket.format` resp. `@ws.format` annotation (e.g. `@ws.format: './format/xyz.js'`).
525527
526528
The custom format class needs to implement the following functions:
527529
528530
- **parse(data)**: Parse the event data into internal data (JSON), i.e. `{ event, data }`
529531
- **compose(event, data)**: Compose the event and internal data (JSON) into a formatted string. For kind `socket.io`, it can also be a JSON object.
530532
531-
In addition, it can implement the following class functions (optional):
533+
In addition, it can implement the following functions (optional):
532534
533535
- **constructor(service)**: Setup instance with service definition on creation
534536
@@ -818,14 +820,15 @@ To use the Redis Adapter (basic publish/subscribe), the following steps have to
818820
819821
###### Custom Adapter
820822
821-
A custom websocket adapter implementation can be provided via relative path set configuration of `cds.websocket.adapter.impl`.
823+
A custom websocket adapter implementation can be provided via a path relative to the project root
824+
with the configuration `cds.websocket.adapter.impl` (e.g. `cds.websocket.adapter.impl: './adapter/xyz.js'`).
822825
823826
The custom adapter class needs to implement the following functions:
824827
825828
- **on(service, path)**: Register an adapter subscription
826829
- **emit(service, path, message)**: Emit an adapter event message
827830
828-
In addition, it can implement the following class functions (optional):
831+
In addition, it can implement the following functions (optional):
829832
830833
- **constructor(server, config)**: Setup instance on creation
831834
- **setup()**: Perform some async setup activities (optional)
@@ -866,8 +869,10 @@ https://socket.io/docs/v4/index-streams-adapter/
866869
867870
###### Custom Adapter
868871
869-
A custom websocket adapter implementation can be provided via relative path set configuration of `cds.websocket.adapter.impl`.
870-
The custom adapter need to fulfill the Socket.IO adapter interface.
872+
A custom websocket adapter implementation can be provided via a path relative to the project root
873+
with the configuration `cds.websocket.adapter.impl` (e.g. `cds.websocket.adapter.impl: './adapter/xyz.js'`).
874+
875+
The custom adapter need to fulfill the Socket.IO adapter interface (https://socket.io/docs/v4/adapter/).
871876
872877
### Deployment
873878

package-lock.json

Lines changed: 38 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
"@types/express": "^4.17.21",
6060
"eslint": "^9.9.1",
6161
"eslint-config-prettier": "^9.1.0",
62-
"eslint-plugin-jest": "^28.8.0",
62+
"eslint-plugin-jest": "^28.8.1",
6363
"eslint-plugin-n": "^17.10.2",
6464
"globals": "^15.9.0",
6565
"jest": "^29.7.0",

0 commit comments

Comments
 (0)