move wss server start after http
| | |
| | | } |
| | | |
| | | if (argv.serve) { |
| | | const wss = new WebSocketServer({ port: 3001 }) |
| | | const connections = [] |
| | | wss.on("connection", (ws) => connections.push(ws)) |
| | | const clientRefresh = () => connections.forEach((conn) => conn.send("rebuild")) |
| | | |
| | | if (argv.baseDir !== "" && !argv.baseDir.startsWith("/")) { |
| | |
| | | return serve() |
| | | }) |
| | | server.listen(argv.port) |
| | | const wss = new WebSocketServer({ port: 3001 }) |
| | | wss.on("connection", (ws) => connections.push(ws)) |
| | | console.log( |
| | | chalk.cyan( |
| | | `Started a Quartz server listening at http://localhost:${argv.port}${argv.baseDir}`, |