Skip to content

Commit d15b2fd

Browse files
Add gateway import way
It adds the way the user can import the file in case of a manual creation, so that it doesn't get lost in the process.
1 parent b369245 commit d15b2fd

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 import it into our module.
57+
58+
```typescript
59+
import { Module } from '@nestjs/common';
60+
import { EventsGatway } from './events.gateway';
61+
62+
@@filename(events.module)
63+
@Module({
64+
providers: [EventsGatway]
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)