]> Skullheadx's Git Forge - monopoly-web.git/commitdiff
lobby backend
authorSkullheadx <admonty1@protonmail.com>
Mon, 8 Jun 2026 02:00:47 +0000 (22:00 -0400)
committerSkullheadx <admonty1@protonmail.com>
Mon, 8 Jun 2026 02:01:41 +0000 (22:01 -0400)
main.go

diff --git a/main.go b/main.go
index dbc722c19323fa498d9223687c5d204f32e5ba90..b718378bcde3ac1b7cc6378ef56cb28dd044f854 100644 (file)
--- a/main.go
+++ b/main.go
@@ -14,20 +14,28 @@ import (
        "time"
 )
 
-type Room struct {
-       gameCtx *game.Context
+func main() {
+       log.SetFlags(0)
+
+       err := run()
+       if err != nil {
+               log.Fatal(err)
+       }
 }
 
-func initRoom() Room {
-       randSeed := rand.NewPCG(20, 26)
-       players := []game.Player{
-               game.InitPlayer(),
+func run() error {
+       l, err := net.Listen("tcp", "127.0.0.1:8443")
+       if err != nil {
+               return err
        }
+       log.Printf("listening on ws://%v", l.Addr())
 
-       return Room{
-               gameCtx: game.InitCtx(randSeed, players),
+       cs := game.NewMonopolyServer()
+       s := &http.Server{
+               Handler:      cs,
+               ReadTimeout:  time.Second * 10,
+               WriteTimeout: time.Second * 10,
        }
-}
 
 const UUID = "abc" // TODO: UUID in cookie