2024-11-21 08:33:29 +00:00
|
|
|
package websocket
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net"
|
|
|
|
"sync"
|
|
|
|
|
|
|
|
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
|
|
|
)
|
|
|
|
|
2024-11-21 17:54:08 +00:00
|
|
|
const BROADCAST_INTERVAL = 1
|
2024-11-21 08:33:29 +00:00
|
|
|
const SEND_TIMEOUT = 10
|
|
|
|
const STALE_CLIENT_TIMEOUT = 90
|
|
|
|
const STALE_CHECK_INTERVALL = 30
|
|
|
|
|
|
|
|
// Clients is a map of connected WebSocket clients, where each client is represented by the WebsocketClient struct
|
|
|
|
var Clients = make(map[net.Addr]*models.WebsocketClient)
|
|
|
|
|
|
|
|
// Mutex to protect access to the Clients map
|
|
|
|
var mu sync.Mutex
|