Skip to content

Commit

Permalink
feat: writeControl
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed Jul 29, 2024
1 parent 73ba02b commit 4926a4a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion node/pkg/dal/api/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package api

import (
"context"
"time"

"bisonai.com/orakl/node/pkg/common/types"
"bisonai.com/orakl/node/pkg/dal/collector"
Expand Down Expand Up @@ -42,8 +43,13 @@ func (c *Hub) Start(ctx context.Context, collector *collector.Collector) {
case conn := <-c.unregister:
c.mu.Lock()
delete(c.clients, conn)
conn.Close()
c.mu.Unlock()
conn.WriteControl(
websocket.CloseMessage,
websocket.FormatCloseMessage(websocket.CloseNormalClosure, ""),
time.Now().Add(time.Second),
)
conn.Close()
}
}
}()
Expand Down

0 comments on commit 4926a4a

Please sign in to comment.