Compare commits
25 commits
d0c3f263c1
...
92260b44db
Author | SHA1 | Date | |
---|---|---|---|
92260b44db | |||
efc34b57b2 | |||
2c3ccc86c3 | |||
68b5784255 | |||
2d469a0b86 | |||
19df804235 | |||
58ac2d2950 | |||
c76ea3628b | |||
51b08b66e0 | |||
2f18b472f6 | |||
b4eff894b8 | |||
84b9e0afd6 | |||
b5e1b5cc88 | |||
7e5b0659b4 | |||
ccd0c38b58 | |||
a25ee424aa | |||
32e00480f8 | |||
d975034680 | |||
c348049209 | |||
c63ef3c12a | |||
2ddc1ef9e4 | |||
9fa740b2c6 | |||
df965e633d | |||
03d94d5999 | |||
75b3ae87d6 |
2 changed files with 4 additions and 4 deletions
|
@ -11,9 +11,10 @@ import (
|
|||
|
||||
// Sends continous messages to all connected WebSocket clients
|
||||
func SendPermanentBroadCastMessage() {
|
||||
tick := time.NewTicker(time.Second)
|
||||
ticker := time.NewTicker(BROADCAST_INTERVAL * time.Second)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
for range ticker.C {
|
||||
// Marshal the message into JSON format
|
||||
jsonMessage, err := json.Marshal(shared.State)
|
||||
if err != nil {
|
||||
|
@ -32,7 +33,5 @@ func SendPermanentBroadCastMessage() {
|
|||
}
|
||||
}
|
||||
mu.Unlock()
|
||||
|
||||
<-tick.C
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
||||
)
|
||||
|
||||
const BROADCAST_INTERVAL = 1
|
||||
const SEND_TIMEOUT = 10
|
||||
const STALE_CLIENT_TIMEOUT = 90
|
||||
const STALE_CHECK_INTERVALL = 30
|
||||
|
|
Loading…
Reference in a new issue