()
| 824 | |
| 825 | // Websocket Notifications |
| 826 | setupReloadNotifier() { |
| 827 | let options = {}; |
| 828 | if(this.options.reloadPort) { |
| 829 | options.port = this.options.reloadPort; |
| 830 | } else { |
| 831 | // includes the port |
| 832 | options.server = this.server; |
| 833 | } |
| 834 | |
| 835 | let updateServer = new WebSocketServer(options); |
| 836 | |
| 837 | updateServer.on("connection", (ws) => { |
| 838 | this.sendUpdateNotification({ |
| 839 | type: "eleventy.status", |
| 840 | status: "connected", |
| 841 | }); |
| 842 | }); |
| 843 | |
| 844 | updateServer.on("error", (err) => { |
| 845 | this._serverErrorHandler(err); |
| 846 | }); |
| 847 | |
| 848 | this.updateServer = updateServer; |
| 849 | } |
| 850 | |
| 851 | // Broadcasts to all open browser windows |
| 852 | sendUpdateNotification(obj) { |
no test coverage detected