webSocket test
This commit is contained in:
parent
7f0a3d1364
commit
7d3847ac0b
2 changed files with 13 additions and 1 deletions
12
src/app.ts
12
src/app.ts
|
|
@ -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!');
|
||||
|
|
|
|||
|
|
@ -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 } });
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue