From 6577238fca07e53974850a8bcced20a302c337b0 Mon Sep 17 00:00:00 2001 From: Fabricio Date: Sun, 2 Dec 2018 14:36:30 -0200 Subject: [PATCH] no need to clear on connection anymore --- dashboard.go | 4 ---- main.go | 4 ---- 2 files changed, 8 deletions(-) diff --git a/dashboard.go b/dashboard.go index 0d8a1f7..4523048 100644 --- a/dashboard.go +++ b/dashboard.go @@ -276,10 +276,6 @@ const dashboardHTML = ` } const evt = new EventSource(<<.DashboardConnPath>>); - evt.addEventListener('connected', e => { - $scope.selectedItem = {}; - $scope.$apply(); - }); evt.addEventListener('captures', e => { $scope.items = JSON.parse(e.data); if (!$scope.items.find(i => i.id == $scope.selectedItem.id)) { diff --git a/main.go b/main.go index 53b2d32..6cf0db4 100644 --- a/main.go +++ b/main.go @@ -58,10 +58,6 @@ func NewDashboardConnHandler(list *CaptureList) http.HandlerFunc { } rw.Header().Set("Content-Type", "text/event-stream") rw.Header().Set("Cache-Control", "no-cache") - - fmt.Fprintf(rw, "event: connected\ndata: %s\n\n", "clear") - rw.(http.Flusher).Flush() - for { jsn, _ := json.Marshal(list.ItemsAsMetadata()) fmt.Fprintf(rw, "event: captures\ndata: %s\n\n", jsn)