Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.
TypeScript cloud-alternativecollaborationcollaborative-editingdropboxfile-serverfile-sharingfile-storagefile-syncfull-text-searchhomelabnextcloudon-premiseopen-sourceprivacy-firstprivate-cloudrealtimesecureself-hostedstorage-serverwebdav
import { WebSocketGateway, WebSocketServer } from '@nestjs/websockets'
import { Server } from 'socket.io'
import { USER_ROOM_PREFIX } from '../users/constants/websocket.js'
import { NOTIFICATIONS_WS } from './constants/websocket.js'
@WebSocketGateway({ namespace: NOTIFICATIONS_WS.NAME_SPACE })
export class WebSocketNotifications {
@WebSocketServer() server!: Server
sendMessageToUsers(userIds: number[], eventName: string, body: any) {
if (userIds.length) {
this.server.to(userIds.map((uid) => `${USER_ROOM_PREFIX}${uid}`)).emit(eventName, body)
}
}
}