webSocket สาธุ99

This commit is contained in:
AdisakKanthawilang 2025-03-06 14:41:41 +07:00
parent a828693d2e
commit 0f639826c3
3 changed files with 27 additions and 37 deletions

View file

@ -31,9 +31,7 @@ import { Profile } from "../entities/Profile";
import { viewRegistryOfficer } from "../entities/view/viewRegistryOfficer";
import { viewRegistryEmployee } from "../entities/view/viewRegistryEmployee";
import { EmployeeTempPosMaster } from "../entities/EmployeeTempPosMaster";
// import { WebSocket } from "ws";
// import { wss } from "../app";
import { sendWebSocket } from "../services/webSocket";
@Route("api/v1/org/report")
@Tags("Report")
@ -3540,21 +3538,9 @@ export class ReportController extends Controller {
}
}
}
// console.log(">>",data);
// wss.clients.forEach((client: any) => {
// if (client.readyState === WebSocket.OPEN) {
// const message = JSON.stringify({ template: "report2", reportName: "report2", data: { data } });
// console.log("📤 Sending data to client:", message);
// client.send(message, (err:any) => {
// if (err) {
// console.error("❌ Error sending message:", err);
// }
// });
// }
// });
return new HttpSuccess({ template: "report2", reportName: "report2", data: { data } });
const metaData = { template: "report2", reportName: "report2", data: { data } };
sendWebSocket(metaData)
// return new HttpSuccess({ template: "report2", reportName: "report2", data: { data } });
}
/**