NewDashboardServer creates a new dashboard server
(cm *manager.ConnManager)
| 24 | |
| 25 | // NewDashboardServer creates a new dashboard server |
| 26 | func NewDashboardServer(cm *manager.ConnManager) *DashboardServer { |
| 27 | server := &DashboardServer{ |
| 28 | collector: NewDashboardCollector(cm), |
| 29 | mux: http.NewServeMux(), |
| 30 | upgrader: websocket.Upgrader{ |
| 31 | CheckOrigin: func(r *http.Request) bool { |
| 32 | return true // Allow all origins for development |
| 33 | }, |
| 34 | }, |
| 35 | clients: make(map[*websocket.Conn]bool), |
| 36 | broadcast: make(chan []byte), |
| 37 | shutdown: make(chan struct{}), |
| 38 | } |
| 39 | |
| 40 | server.setupRoutes() |
| 41 | server.startBroadcaster() |
| 42 | return server |
| 43 | } |
| 44 | |
| 45 | // setupRoutes configures all API routes |
| 46 | func (ds *DashboardServer) setupRoutes() { |
no test coverage detected