работаем бля работаем
This commit is contained in:
10
server/plugins/socket/chat/index.ts
Normal file
10
server/plugins/socket/chat/index.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { FastifyInstance } from 'fastify'
|
||||
import type { MessageSelect } from '../../../prisma/generated-client/models.ts'
|
||||
|
||||
export default async function (fastify: FastifyInstance) {
|
||||
const { io, bus } = fastify
|
||||
|
||||
bus.on('chat:new-message', async (message: MessageSelect) => {
|
||||
io.emit('chat:new-message', message)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user