import{WebSocketServer as i,WebSocket as f}from"ws";import{logger as s}from"../tools/notifiers/logger.js";function u(c){const o=new i({server:c});let t=!1;return o.on("connection",function(r){r.send(JSON.stringify({type:"ready"})),s.verbose("Hot reload client connected")}),{broadcast:e=>{t||o.clients.forEach(function(n){n.readyState===f.OPEN&&n.send(JSON.stringify(e))})},onConnect:e=>{o.on("connection",function(n){e(n)})},freeze:()=>{t=!0},unfreeze:()=>{t=!1}}}export{u as attachWsServer};
