fix: analytic not send data

This commit is contained in:
0xJacky 2023-07-12 00:05:59 +08:00
parent 2bc14bd23b
commit cc6a325ddd
No known key found for this signature in database
GPG key ID: B6E4A6E4A561BAF0
2 changed files with 169 additions and 166 deletions

View file

@ -67,7 +67,7 @@ export default defineConfig({
server: {
proxy: {
'/api': {
target: 'http://127.0.0.1:9001/',
target: 'http://127.0.0.1:9002/',
changeOrigin: true,
secure: false,
ws: true

View file

@ -90,6 +90,7 @@ func Analytic(c *gin.Context) {
}
// write
err = ws.WriteJSON(stat)
if err != nil || websocket.IsUnexpectedCloseError(err,
websocket.CloseGoingAway,
websocket.CloseNoStatusReceived,
@ -172,6 +173,7 @@ func GetNodeStat(c *gin.Context) {
for {
// write
err = ws.WriteJSON(analytic.GetNodeStat())
if err != nil || websocket.IsUnexpectedCloseError(err,
websocket.CloseGoingAway,
websocket.CloseNoStatusReceived,
@ -201,6 +203,7 @@ func GetNodesAnalytic(c *gin.Context) {
for {
// write
err = ws.WriteJSON(analytic.NodeMap)
if err != nil || websocket.IsUnexpectedCloseError(err,
websocket.CloseGoingAway,
websocket.CloseNoStatusReceived,