webSocket test

This commit is contained in:
AdisakKanthawilang 2025-03-06 13:47:40 +07:00
parent 7f0a3d1364
commit 7d3847ac0b
2 changed files with 13 additions and 1 deletions

View file

@ -126,6 +126,18 @@ async function main() {
});
});
wss.clients.forEach((client: any) => {
if (client.readyState === WebSocket.OPEN) {
const message = "";
console.log("📤 Sending data to client:", message);
client.send(message, (err:any) => {
if (err) {
console.error("❌ Error sending message:", err);
}
});
}
});
// ตั้งค่า Express routes
app.get('/', (req, res) => {
res.send('Hello from Express!');

View file

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