вложения, канальчики, бим-бим + бам-бам

This commit is contained in:
2026-04-25 00:51:12 +06:00
parent 0b75148a3f
commit ad477ee813
61 changed files with 14636 additions and 375 deletions

View File

@@ -1,5 +1,6 @@
import type { FastifyInstance } from 'fastify'
import type { ServerOptions } from 'socket.io'
import type { MessageSelect } from '../prisma/generated-client/models/Message.ts'
import fp from 'fastify-plugin'
import { Server } from 'socket.io'
import registerChatSocket from '../socket/chat.ts'
@@ -23,9 +24,11 @@ export default fp<Partial<ServerOptions>>(
await fastify.io.close()
})
fastify.ready(async () => {
await registerWebrtcSocket(fastify.io, fastify.mediasoupRouter)
await registerChatSocket(fastify.io)
await registerWebrtcSocket(fastify.io, fastify.mediasoupRouter, fastify.prisma)
await registerChatSocket(fastify.io)
fastify.bus.on('chat:new-message', async (message: MessageSelect) => {
fastify.io.emit('chat:new-message', message)
})
},
{ name: 'socket-io', dependencies: ['mediasoup-worker', 'mediasoup-router'] },