aboutsummaryrefslogtreecommitdiffhomepage
path: root/backend/game/hub.go
diff options
context:
space:
mode:
Diffstat (limited to 'backend/game/hub.go')
-rw-r--r--backend/game/hub.go28
1 files changed, 27 insertions, 1 deletions
diff --git a/backend/game/hub.go b/backend/game/hub.go
index d4a9231..770d257 100644
--- a/backend/game/hub.go
+++ b/backend/game/hub.go
@@ -121,6 +121,14 @@ func (hub *gameHub) run() {
},
}
}
+ for watcher := range hub.watchers {
+ watcher.s2cMessages <- &watcherMessageS2CStart{
+ Type: watcherMessageTypeS2CStart,
+ Data: watcherMessageS2CStartPayload{
+ StartAt: int(startAt.Unix()),
+ },
+ }
+ }
err := hub.q.UpdateGameStartedAt(hub.ctx, db.UpdateGameStartedAtParams{
GameID: int32(hub.game.gameID),
StartedAt: pgtype.Timestamp{
@@ -151,9 +159,27 @@ func (hub *gameHub) run() {
Type: playerMessageTypeS2CExecResult,
Data: playerMessageS2CExecResultPayload{
Score: &score,
- Status: api.Success,
+ Status: api.GamePlayerMessageS2CExecResultPayloadStatusSuccess,
},
}
+ for watcher := range hub.watchers {
+ watcher.s2cMessages <- &watcherMessageS2CCode{
+ Type: watcherMessageTypeS2CCode,
+ Data: watcherMessageS2CCodePayload{
+ PlayerId: message.client.playerID,
+ Code: code,
+ },
+ }
+ watcher.s2cMessages <- &watcherMessageS2CExecResult{
+ Type: watcherMessageTypeS2CExecResult,
+ Data: watcherMessageS2CExecResultPayload{
+ PlayerId: message.client.playerID,
+ Score: &score,
+ Stdout: "",
+ Stderr: "",
+ },
+ }
+ }
default:
log.Fatalf("unexpected message type: %T", message.message)
}