вложения, канальчики, бим-бим + бам-бам
This commit is contained in:
@@ -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'] },
|
||||
|
||||
Reference in New Issue
Block a user