Skip to content

Commit

Permalink
Merge pull request #2242 from cbebe/cbebe-patch-1
Browse files Browse the repository at this point in the history
docs: Adjust grammatical errors in gateways.md
  • Loading branch information
kamilmysliwiec committed Mar 11, 2022
2 parents 7dfe116 + c950b98 commit 7954b80
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions content/websockets/gateways.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ handleEvent(data, client) {

> info **Hint** `@ConnectedSocket()` decorator is imported from `@nestjs/websockets` package.
However, in this case, you won't be able to leverage interceptors. If you don't want to respond to the user, you can simple skip the `return` statement (or explicitly return "falsy" value, e.g. `undefined`).
However, in this case, you won't be able to leverage interceptors. If you don't want to respond to the user, you can simply skip the `return` statement (or explicitly return a "falsy" value, e.g. `undefined`).

Now when a client emits the message as follows:

Expand All @@ -138,7 +138,7 @@ socket.emit('events', { name: 'Nest' }, (data) => console.log(data));

#### Multiple responses

The acknowledgment is dispatched only once. Furthermore, it is not supported by native WebSockets implementation. To solve this limitation, you may return an object which consist of two properties. The `event` which is a name of the emitted event and the `data` that has to be forwarded to the client.
The acknowledgment is dispatched only once. Furthermore, it is not supported by native WebSockets implementation. To solve this limitation, you may return an object which consists of two properties. The `event` which is a name of the emitted event and the `data` that has to be forwarded to the client.

```typescript
@@filename(events.gateway)
Expand All @@ -158,7 +158,7 @@ handleEvent(data) {

> info **Hint** The `WsResponse` interface is imported from `@nestjs/websockets` package.
> warning **Warning** You should return a class instance that implements `WsResponse` if your `data` field relies on `ClassSerializerInterceptor`, as it ignores plain JavaScript objects responses.
> warning **Warning** You should return a class instance that implements `WsResponse` if your `data` field relies on `ClassSerializerInterceptor`, as it ignores plain JavaScript object responses.
In order to listen for the incoming response(s), the client has to apply another event listener.

Expand Down

0 comments on commit 7954b80

Please sign in to comment.