| 3 | import type { FastifyPluginCallback } from 'fastify'; |
| 4 | |
| 5 | const liveRouter: FastifyPluginCallback = async (fastify) => { |
| 6 | fastify.register(fastifyWS); |
| 7 | |
| 8 | fastify.register(async (fastify) => { |
| 9 | fastify.get( |
| 10 | '/organization/:organizationId', |
| 11 | { websocket: true }, |
| 12 | controller.wsOrganizationEvents, |
| 13 | ); |
| 14 | fastify.get( |
| 15 | '/visitors/:projectId', |
| 16 | { websocket: true }, |
| 17 | controller.wsVisitors, |
| 18 | ); |
| 19 | fastify.get( |
| 20 | '/events/:projectId', |
| 21 | { websocket: true }, |
| 22 | controller.wsProjectEvents, |
| 23 | ); |
| 24 | fastify.get( |
| 25 | '/notifications/:projectId', |
| 26 | { websocket: true }, |
| 27 | controller.wsProjectNotifications, |
| 28 | ); |
| 29 | }); |
| 30 | }; |
| 31 | |
| 32 | export default liveRouter; |