Skip to content

Commit 82db495

Browse files
Merge pull request #2050 from AndersonAlpin/patch-1
docs(gateway): add gateway file import to module
2 parents dd0a083 + b1026af commit 82db495

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

content/websockets/gateways.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ handleEvent(data) {
5353

5454
> info **Hint** `@SubscribeMessage()` and `@MessageBody()` decorators are imported from `@nestjs/websockets` package.
5555
56+
Once the gateway is created, we can register it in our module.
57+
58+
```typescript
59+
import { Module } from '@nestjs/common';
60+
import { EventsGateway } from './events.gateway';
61+
62+
@@filename(events.module)
63+
@Module({
64+
providers: [EventsGateway]
65+
})
66+
export class EventsModule {}
67+
```
68+
5669
You can also pass in a property key to the decorator to extract it from the incoming message body:
5770

5871
```typescript

0 commit comments

Comments
 (0)