
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
@betsys-nestjs/websocket
Advanced tools
A base for handling websocket connections including implementation of RedisAdapter using Redis library and Monitoring using Monitoring library
For this library to work, you need to install the following peer dependencies:
| Package | Version |
|---|---|
| @nestjs/common | ^9.0.0 |
| @nestjs/core | ^9.0.0 |
| @betsys-nestjs/logger | ^2.0.0 |
| @betsys-nestjs/monitoring | ^4.0.0 |
| @betsys-nestjs/redis | ^1.0.0 |
| @nestjs/terminus | ^9.0.0 |
| reflect-metadata | >=0.1.13 <0.2.0 |
| rxjs | >=7.8.0 <8.0.0 |
To start using this library simply import WebsocketModule and use it like this:
import { WebsocketModule } from '@betsys-nestjs/websocket'
import { Module } from "@nestjs/common";
@Module({
imports: [
WebsocketModule.forRoot()
]
})
class AppModule {
}
Then you can start using the module exports.
AbstractGateway and WebsocketMonitoringService usage example:import {
ConnectedSocket,
WebSocketGateway,
AbstractGateway,
WebsocketMonitoringService
} from '@nestjs/websockets';
import { Server, Socket } from 'socket.io';
@WebSocketGateway({
transports: ['websocket'],
namespace: 'test',
})
export class TestSocketGateway extends AbstractGateway {
constructor(
private readonly monitoring: WebsocketMonitoringService,
) {
super(monitoring);
}
afterInit(server: Server): void {
super.afterInit(server);
}
async handleConnection(@ConnectedSocket() socket: Socket): Promise<void> {
try {
await super.handleConnection(socket);
} catch (e) {
socket.disconnect(true);
}
}
async handleDisconnect(@ConnectedSocket() socket: Socket): Promise<void> {
try {
super.handleDisconnect(socket);
} finally {
socket.leave('');
}
}
}
RedisAdapter usage example:import { RedisIoAdapter } from '@betsys/websocket';
app.useWebSocketAdapter(new RedisIoAdapter(app, redisConfig));
FAQs
Library for handling websocket connections
The npm package @betsys-nestjs/websocket receives a total of 3 weekly downloads. As such, @betsys-nestjs/websocket popularity was classified as not popular.
We found that @betsys-nestjs/websocket demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.