Compare commits

..

5 commits

3 changed files with 2 additions and 3 deletions

View file

@ -25,7 +25,6 @@ func SendPermanentBroadCastMessage() {
mu.Lock() mu.Lock()
for _, client := range Clients { for _, client := range Clients {
// Send message to client // Send message to client
client.Conn.SetWriteDeadline(time.Now().Add(SEND_TIMEOUT * time.Second)) client.Conn.SetWriteDeadline(time.Now().Add(SEND_TIMEOUT * time.Second))
err := client.Conn.WriteMessage(websocket.TextMessage, jsonMessage) err := client.Conn.WriteMessage(websocket.TextMessage, jsonMessage)
if err != nil { if err != nil {

View file

@ -25,7 +25,7 @@ func isStale(client *models.WebsocketClient) bool {
// Check and remove stale clients // Check and remove stale clients
func RemoveStaleClients() { func RemoveStaleClients() {
ticker := time.NewTicker(CHECK_INTERVALL * time.Second) ticker := time.NewTicker(STALE_CHECK_INTERVALL * time.Second)
defer ticker.Stop() defer ticker.Stop()
for range ticker.C { for range ticker.C {

View file

@ -2,4 +2,4 @@ package websocket
const SEND_TIMEOUT = 10 const SEND_TIMEOUT = 10
const STALE_CLIENT_TIMEOUT = 90 const STALE_CLIENT_TIMEOUT = 90
const CHECK_INTERVALL = 30 const STALE_CHECK_INTERVALL = 30