nest-udp-adapter
v0.1.0
Published
A Nest UDP adapter based on @nestjs/websockets
Downloads
1
Maintainers
Readme
nest-udp-adapter
A Nest UDP adapter based on @nestjs/websockets
Installation
To begin using it, we first install the required dependency.
$ npm install --save @nestjs/websockets nest-udp-adapter
Getting started
Once the installation is complete, we can set up UDP adapter using useWebSocketAdapter()
method:
const app = await NestFactory.create(AppModule);
app.useWebSocketAdapter(new UdpAdapter(app, {
type: 'udp4',
port: 41234,
}));
The second argument of the UdpAdapter
constructor is an options
object. This object may consist of seven members:
Example
A working example is available here.