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: { server: {
proxy: { proxy: {
'/api': { '/api': {
target: 'http://127.0.0.1:9001/', target: 'http://127.0.0.1:9002/',
changeOrigin: true, changeOrigin: true,
secure: false, secure: false,
ws: true ws: true

View file

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