refactor
All checks were successful
Deploy / deploy (push) Successful in 34s

This commit is contained in:
2025-12-26 01:22:34 +06:00
parent 778f0a5687
commit a5cda8828f

View File

@@ -1,4 +1,5 @@
import type { FastifyInstance } from 'fastify'
import type { Namespace } from '../types/webrtc.ts'
import { z } from 'zod'
import prisma from '../prisma/client.ts'
import { socketToClient } from '../utils/socket-to-client.ts'
@@ -69,16 +70,13 @@ export default function (fastify: FastifyInstance) {
},
})
const namespace = fastify.io.of('/webrtc')
const namespace: Namespace = fastify.io.of('/webrtc')
const sockets = await namespace.fetchSockets()
console.log(sockets)
const found = sockets.find(socket => socket.id === req.user!.id)
const found = sockets.find(socket => socket.data.joined && socket.data.userId === req.user!.id)
if (found) {
found.data.displayName = input.displayName
console.log('found.', found)
namespace.emit('clientChanged', found.id, socketToClient(found))
}