11 lines
331 B
TypeScript
11 lines
331 B
TypeScript
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)
|
|
})
|
|
}
|