0.2.0 • Published 7 months ago

nest-udp2ws-adapter v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

nest-udp2ws-adapter

NPM version

A Nest WebSocket adapter for relaying UDP packets to ws server

Installation

To begin using it, we first install the required dependency.

$ npm install --save @nestjs/websockets nest-udp2ws-adapter ws
$ npm install --save-dev @types/ws

Getting started

Once the installation is complete, we can set up the adapter using useWebSocketAdapter() method:

const app = await NestFactory.create(AppModule);
app.useWebSocketAdapter(new Udp2wsAdapter(app, {
  type: 'udp4',
  port: 41234,
}));

The second argument of the Udp2wsAdapter constructor is an options object. This object may consist of seven members:

Example

A working example is available here.

License

MIT

0.2.0

7 months ago

0.1.0

7 months ago