This commit is contained in:
AdisakKanthawilang 2025-03-06 15:04:13 +07:00
parent 42cb907cfc
commit 4de905972c
3 changed files with 7 additions and 7 deletions

View file

@ -13,9 +13,11 @@ import { OrganizationController } from "./controllers/OrganizationController";
import logMiddleware from "./middlewares/logs"; import logMiddleware from "./middlewares/logs";
import { CommandController } from "./controllers/CommandController"; import { CommandController } from "./controllers/CommandController";
import { ProfileSalaryController } from "./controllers/ProfileSalaryController"; import { ProfileSalaryController } from "./controllers/ProfileSalaryController";
import { WebSocketServer } from "ws";
import http from "http"; import http from "http";
import { wss } from "../src/services/webSocket"; export const wss = new WebSocketServer({ noServer: true,
path: "/api/v1/org/socket",
});
async function main() { async function main() {
await AppDataSource.initialize(); await AppDataSource.initialize();

View file

@ -3540,7 +3540,7 @@ export class ReportController extends Controller {
} }
const metaData = { template: "report2", reportName: "report2", data: { data } }; const metaData = { template: "report2", reportName: "report2", data: { data } };
sendWebSocket(metaData) sendWebSocket(metaData)
// return new HttpSuccess({ template: "report2", reportName: "report2", data: { data } }); return new HttpSuccess();
} }
/** /**

View file

@ -1,7 +1,5 @@
import { WebSocket, WebSocketServer } from "ws"; import { WebSocket } from "ws";
export const wss = new WebSocketServer({ noServer: true, import { wss } from "../app";
path: "/api/v1/org/socket",
});
export async function sendWebSocket(data:any){ export async function sendWebSocket(data:any){
wss.clients.forEach((client: any) => { wss.clients.forEach((client: any) => {