Compare commits
24 commits
92260b44db
...
d0c3f263c1
Author | SHA1 | Date | |
---|---|---|---|
d0c3f263c1 | |||
0b6b680cce | |||
45b18ae7ab | |||
6100526610 | |||
71427f2879 | |||
c1f158f42a | |||
80ddfe57f4 | |||
e8cc2d1808 | |||
df98628d91 | |||
2faa95c162 | |||
a0463ad817 | |||
0ab0884508 | |||
bf9b818940 | |||
f4b1e7c808 | |||
8295208a0b | |||
18accba19a | |||
62b6ab81a5 | |||
ed6902def0 | |||
6f60423c03 | |||
409fd741dd | |||
15f6b0227a | |||
201e5779e6 | |||
2d8816f4ba | |||
370469de36 |
2 changed files with 4 additions and 4 deletions
|
@ -11,10 +11,9 @@ import (
|
||||||
|
|
||||||
// Sends continous messages to all connected WebSocket clients
|
// Sends continous messages to all connected WebSocket clients
|
||||||
func SendPermanentBroadCastMessage() {
|
func SendPermanentBroadCastMessage() {
|
||||||
ticker := time.NewTicker(BROADCAST_INTERVAL * time.Second)
|
tick := time.NewTicker(time.Second)
|
||||||
defer ticker.Stop()
|
|
||||||
|
|
||||||
for range ticker.C {
|
for {
|
||||||
// Marshal the message into JSON format
|
// Marshal the message into JSON format
|
||||||
jsonMessage, err := json.Marshal(shared.State)
|
jsonMessage, err := json.Marshal(shared.State)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -33,5 +32,7 @@ func SendPermanentBroadCastMessage() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mu.Unlock()
|
mu.Unlock()
|
||||||
|
|
||||||
|
<-tick.C
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@ import (
|
||||||
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
"git.smsvc.net/pomodoro/GoTomato/pkg/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
const BROADCAST_INTERVAL = 1
|
|
||||||
const SEND_TIMEOUT = 10
|
const SEND_TIMEOUT = 10
|
||||||
const STALE_CLIENT_TIMEOUT = 90
|
const STALE_CLIENT_TIMEOUT = 90
|
||||||
const STALE_CHECK_INTERVALL = 30
|
const STALE_CHECK_INTERVALL = 30
|
||||||
|
|
Loading…
Reference in a new issue