0% found this document useful (0 votes)
3 views

docs-nestjs-com-websockets-interceptors...

The document discusses the use of interceptors in NestJS, highlighting that there is no distinction between regular interceptors and web socket interceptors. It provides an example of a method-scoped interceptor using the @UseInterceptors() decorator. Additionally, it promotes support for the open-source Nest project and invites users to subscribe to a newsletter for updates.

Uploaded by

dharmendra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

docs-nestjs-com-websockets-interceptors...

The document discusses the use of interceptors in NestJS, highlighting that there is no distinction between regular interceptors and web socket interceptors. It provides an example of a method-scoped interceptor using the @UseInterceptors() decorator. Additionally, it promotes support for the open-source Nest project and invites users to subscribe to a newsletter for updates.

Uploaded by

dharmendra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Search dark_mode

Interceptors
There is no difference between regular interceptors and web sockets
interceptors. The following example uses a manually instantiated method-
scoped interceptor. Just as with HTTP based applications, you can also use
Design and
gateway-scoped interceptors (i.e., prefix the gateway class with a
Development tips in
@UseInterceptors() decorator). your inbox. Every
weekday.
ADS VIA CARBON

JS

@UseInterceptors(new TransformInterceptor()) content_copy


@SubscribeMessage('events')
handleEvent(client: Client, data: unknown): WsResponse<unknown> {
const event = 'events';
return { event, data };
}

Support us

Nest is an MIT-licensed open source project. It can grow thanks to the support by these awesome
people. If you'd like to join them, please read more here.

Principal Sponsors

Sponsors / Partners
Become a sponsor

Join our Newsletter


Subscribe to stay up to date with the latest Nest updates, features, and videos!

Email address..

Copyright © 2017-2025 MIT by Kamil Mysliwiec design by Jakub Staron


Official NestJS Consulting Trilon.io hosted by Netlify

You might also like