Skip to content

Commit abc8d4c

Browse files
Update content/websockets/adapter.md
1 parent c2c6a3d commit abc8d4c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

content/websockets/adapter.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,19 +94,16 @@ app.useWebSocketAdapter(new WsAdapter(app));
9494

9595
> info **Hint** The `WsAdapter` is imported from `@nestjs/platform-ws`.
9696
97-
The `wsAdapter` can only route messages in the `{{ '{' }} event: string, data: any {{ '}' }}` format. If you need to receive and process messages in other formats, you should set up an appropriate message parser to convert the messages into the `{{ '{' }} event: string, data: any {{ '}' }}` format.
97+
The `wsAdapter` is designed to handle messages in the `{{ '{' }} event: string, data: any {{ '}' }}` format. If you need to receive and process messages in a different format, you'll need to configure a message parser to convert them into this required format.
9898

9999
```typescript
100100
const wsAdapter = new WsAdapter(app, {
101-
// to process [event, data] format messages
101+
// To handle messages in the [event, data] format
102102
messageParser: (data) => {
103103
const [event, payload] = JSON.parse(data.toString());
104104
return { event, data: payload };
105105
},
106106
});
107-
```
108-
109-
You can also set up after the adapter is created using the `setMessageParser` method.
110107

111108
#### Advanced (custom adapter)
112109

0 commit comments

Comments
 (0)