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
> info **Hint** The `WsAdapter` is imported from `@nestjs/platform-ws`.
96
96
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 preprocessor to convert the messages into the `{event: string, data: any }` format.
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.
You can also set up after the adapter is created using the `setMessageParser` method.
110
+
109
111
#### Advanced (custom adapter)
110
112
111
113
For demonstration purposes, we are going to integrate the [ws](https://github.com/websockets/ws) library manually. As mentioned, the adapter for this library is already created and is exposed from the `@nestjs/platform-ws` package as a `WsAdapter` class. Here is how the simplified implementation could potentially look like:
0 commit comments