reverse
This commit is contained in:
parent
fa073242b8
commit
b24a900198
3 changed files with 19 additions and 22 deletions
|
|
@ -1,16 +1,16 @@
|
|||
import { WebSocket } from "ws";
|
||||
import { wss } from "../app";
|
||||
// import { WebSocket } from "ws";
|
||||
// import { wss } from "../app";
|
||||
|
||||
export async function sendWebSocket(data:any){
|
||||
wss.clients.forEach((client: any) => {
|
||||
if (client.readyState === WebSocket.OPEN) {
|
||||
const message = JSON.stringify(data);
|
||||
console.log("📤 Sending data to client:", message);
|
||||
client.send(message, (err:any) => {
|
||||
if (err) {
|
||||
console.error("❌ Error sending message:", err);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
// export async function sendWebSocket(data:any){
|
||||
// wss.clients.forEach((client: any) => {
|
||||
// if (client.readyState === WebSocket.OPEN) {
|
||||
// const message = JSON.stringify(data);
|
||||
// console.log("📤 Sending data to client:", message);
|
||||
// client.send(message, (err:any) => {
|
||||
// if (err) {
|
||||
// console.error("❌ Error sending message:", err);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
Loading…
Add table
Add a link
Reference in a new issue