NestJS UWebSocket.js adapter
npm install @proton/nestjs-uws``bash`
npm i nestjs-uws
`typescript
import { UWebSocketAdapter } from 'nestjs-uws';
const app = await NestFactory.create(ApplicationModule);
app.useWebSocketAdapter(new UWebSocketAdapter({
port: 8099,
}));
`
You can't create SSL secure APP for now. You will need to use reverse-proxy to hide the websocket server behind.
UWS Adapter options
| Name | Type |
|---|---|
|port|number|
To use the NestJS WebSocket gateway decorators you should implement the base packet structure
and send any messages from the client using the next structure
`javascript``
{
"event": String,
"data": any
}