logger, compiler logic, sse endpoints
This commit is contained in:
@@ -1,2 +1,32 @@
|
||||
package frontend
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"fmt"
|
||||
"git.noctra.dev/noctra/servtex/globals"
|
||||
)
|
||||
|
||||
// Publishes Meta Information relating to last execution
|
||||
// Does not use contained Mutex, ignore warning
|
||||
func SSEStatus(writer http.ResponseWriter, request *http.Request) {
|
||||
writer.Header().Set("Content-Type", "text/event-stream")
|
||||
writer.Header().Set("Cache-Control", "no-cache")
|
||||
writer.Header().Set("Connection", "keep-alive")
|
||||
|
||||
fmt.Fprintf(writer, "data: Execution Time: %s\n", globals.LatexExec.Timestamp)
|
||||
fmt.Fprintf(writer, "data: Execution State: %s\n\n", globals.LatexExec.ExecutionState)
|
||||
|
||||
writer.(http.Flusher).Flush()
|
||||
}
|
||||
|
||||
func SSEOutput(writer http.ResponseWriter, request *http.Request) {
|
||||
writer.Header().Set("Content-Type", "text/event-stream")
|
||||
writer.Header().Set("Cache-Control", "no-cache")
|
||||
writer.Header().Set("Connection", "keep-alive")
|
||||
|
||||
fmt.Fprintf(writer, "data: Execution Time: %s\n", globals.LatexExec.Timestamp)
|
||||
fmt.Fprintf(writer, "data: Execution State: %s\n\n", globals.LatexExec.ExecutionState)
|
||||
|
||||
writer.(http.Flusher).Flush()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user