test
This commit is contained in:
parent
2c13dae452
commit
e69fd7b33b
2 changed files with 43 additions and 31 deletions
|
|
@ -32,6 +32,9 @@ 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 clients
|
||||
|
||||
@Route("api/v1/org/report")
|
||||
@Tags("Report")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -3537,8 +3540,19 @@ export class ReportController extends Controller {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new HttpSuccess({ template: "report2", reportName: "report2", data: { data } });
|
||||
|
||||
// ✅ ส่งข้อมูลไปยังทุกไคลเอนต์ที่เชื่อมต่อ WebSocket
|
||||
wss.clients.forEach((client) => {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
if (client.readyState === 1) {
|
||||
client.send(
|
||||
JSON.stringify({ template: "report2", reportName: "report2", data: { data } }),
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// return new HttpSuccess({ template: "report2", reportName: "report2", data: { data } });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue