continue dispatch-server
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
import { pubClient } from "modules/redis";
|
||||
import { Server, Socket } from "socket.io";
|
||||
|
||||
export const handle = async (socket: Socket, io: Server) => {
|
||||
console.log("Connected to dispatch server");
|
||||
socket.on("disconnect", () => {
|
||||
export const handle = (socket: Socket, io: Server) => async (jwt: string) => {
|
||||
const userId = socket.data.user.id; // User ID aus dem JWT-Token
|
||||
await pubClient.set(`dispatchers:${socket.id}`, userId);
|
||||
|
||||
socket.join("dispatchers"); // Dem Dispatcher-Raum beitreten
|
||||
|
||||
socket.on("disconnect", async () => {
|
||||
console.log("Disconnected from dispatch server");
|
||||
await pubClient.del(`dispatchers:${socket.id}`);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user