no need to clear on connection anymore
This commit is contained in:
parent
a1d03ff264
commit
6577238fca
|
@ -276,10 +276,6 @@ const dashboardHTML = `
|
||||||
}
|
}
|
||||||
|
|
||||||
const evt = new EventSource(<<.DashboardConnPath>>);
|
const evt = new EventSource(<<.DashboardConnPath>>);
|
||||||
evt.addEventListener('connected', e => {
|
|
||||||
$scope.selectedItem = {};
|
|
||||||
$scope.$apply();
|
|
||||||
});
|
|
||||||
evt.addEventListener('captures', e => {
|
evt.addEventListener('captures', e => {
|
||||||
$scope.items = JSON.parse(e.data);
|
$scope.items = JSON.parse(e.data);
|
||||||
if (!$scope.items.find(i => i.id == $scope.selectedItem.id)) {
|
if (!$scope.items.find(i => i.id == $scope.selectedItem.id)) {
|
||||||
|
|
4
main.go
4
main.go
|
@ -58,10 +58,6 @@ func NewDashboardConnHandler(list *CaptureList) http.HandlerFunc {
|
||||||
}
|
}
|
||||||
rw.Header().Set("Content-Type", "text/event-stream")
|
rw.Header().Set("Content-Type", "text/event-stream")
|
||||||
rw.Header().Set("Cache-Control", "no-cache")
|
rw.Header().Set("Cache-Control", "no-cache")
|
||||||
|
|
||||||
fmt.Fprintf(rw, "event: connected\ndata: %s\n\n", "clear")
|
|
||||||
rw.(http.Flusher).Flush()
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
jsn, _ := json.Marshal(list.ItemsAsMetadata())
|
jsn, _ := json.Marshal(list.ItemsAsMetadata())
|
||||||
fmt.Fprintf(rw, "event: captures\ndata: %s\n\n", jsn)
|
fmt.Fprintf(rw, "event: captures\ndata: %s\n\n", jsn)
|
||||||
|
|
Loading…
Reference in a new issue