Connected Button Added now working

This commit is contained in:
NigeParis 2025-11-24 18:03:21 +01:00 committed by Maix0
parent deaf58dfce
commit 40b807efc8
2 changed files with 5 additions and 4 deletions

View file

@ -10,7 +10,8 @@ import { Server, Socket } from 'socket.io';
declare const __SERVICE_NAME: string;
// Global map of clients
const clientChat = new Map<string, string>(); // key = client name, value = socket
// key = socket, value = clientname
const clientChat = new Map<string, string>();
// @ts-expect-error: import.meta.glob is a vite thing. Typescript doesn't know this...
const plugins = import.meta.glob('./plugins/**/*.ts', { eager: true });
@ -110,8 +111,8 @@ async function onReady(fastify: FastifyInstance) {
// console.log(color.green,"count: ", count);
console.log(color.yellow, 'Client:', color.reset, username);
const targetSocketId: any = target;
io.to(targetSocketId).emit('listObj', username);
const targetSocketId = target;
io.to(targetSocketId!).emit('listObj', username);
console.log(
color.yellow,

View file

@ -23,7 +23,7 @@ const route: FastifyPluginAsync = async (fastify): Promise<void> => {
config: { requireAuth: true },
},
async (req, res) => {
//console.log('/api/chat/test called =================>');
// console.log('/api/chat/test called =================>');
res.makeResponse(200, 'success', 'CCChat.success', { name: 'My_namw', 'id': req.authUser!.id, guest: false });
},
);