diff --git a/src/events/login.ts b/src/events/login.ts index 595be55..6fdeaf8 100644 --- a/src/events/login.ts +++ b/src/events/login.ts @@ -1,3 +1,4 @@ +import { Socket } from 'socket.io'; import { z } from 'zod'; import { io } from '@index'; @@ -40,7 +41,7 @@ const validation = z.object({ }); export default class Login { - async handle({ socket, callback, data }) { + async handle({ socket, callback, data }: { socket: Socket; callback: any; data: any }) { const token = data?.token || socket.handshake.headers.authorization; const val = validation.safeParse({ diff --git a/src/events/playerTimestamp.ts b/src/events/playerTimestamp.ts index e9abba7..f37caf6 100644 --- a/src/events/playerTimestamp.ts +++ b/src/events/playerTimestamp.ts @@ -1,6 +1,6 @@ import type { Socket } from 'socket.io'; -import { get } from '@utils/cache'; +import { get, set } from '@utils/cache'; import { Participant } from './login'; @@ -31,6 +31,7 @@ export default class MuteOrUnmuteParticipant { if (pass) { socket.broadcast.to(room).emit('playerTimestamp', { timestamp: videoTimestamp }); + await set(`room:${room}:timestamp`, videoTimestamp); } } } diff --git a/src/index.ts b/src/index.ts index 913bf94..4d8323d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -42,6 +42,10 @@ const chatBotProps = { (async () => { const events = await traverseEvents(); + app.get('/', (res, _) => { + res.writeStatus('200 OK').end('obezanime watch together socket 👌'); + }); + io.attachApp(app, { cors: { origin: process.env.CORS_ORIGIN,