import * as SocketIO from 'socket.io'
import { authenticateSocket } from '../middlewares'
-import { UserNotificationModel } from '../models/account/user-notification'
import { logger } from '../helpers/logger'
import { Server } from 'http'
+import { UserNotificationModelForApi } from '@server/typings/models/user'
class PeerTubeSocket {
})
}
- sendNotification (userId: number, notification: UserNotificationModel) {
+ sendNotification (userId: number, notification: UserNotificationModelForApi) {
const sockets = this.userNotificationSockets[userId]
if (!sockets) return
+ const notificationMessage = notification.toFormattedJSON()
for (const socket of sockets) {
- socket.emit('new-notification', notification.toFormattedJSON())
+ socket.emit('new-notification', notificationMessage)
}
}