Add initial project structure for "Escape From Teacher" game: server, client, level editor, and asset framework. Includes game rendering, physics, WebSocket server, NATS integration, and asset management setup.
This commit is contained in:
38
test_nats.go
Normal file
38
test_nats.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"git.zb-server.de/ZB-Server/EscapeFromTeacher/pkg/game"
|
||||
"github.com/nats-io/nats.go"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.Println("🧪 NATS Test Publisher startet...")
|
||||
|
||||
nc, err := nats.Connect("nats://localhost:4222")
|
||||
if err != nil {
|
||||
log.Fatal("❌ Verbindung fehlgeschlagen:", err)
|
||||
}
|
||||
defer nc.Close()
|
||||
|
||||
ec, _ := nats.NewEncodedConn(nc, nats.JSON_ENCODER)
|
||||
|
||||
log.Println("✅ Verbunden. Sende Test-Nachricht...")
|
||||
|
||||
req := game.JoinRequest{
|
||||
Name: "TestPlayer",
|
||||
RoomID: "testroom",
|
||||
}
|
||||
|
||||
err = ec.Publish("game.join", req)
|
||||
if err != nil {
|
||||
log.Println("❌ Publish Fehler:", err)
|
||||
} else {
|
||||
log.Println("📤 Test-Nachricht gesendet!")
|
||||
}
|
||||
|
||||
time.Sleep(2 * time.Second)
|
||||
log.Println("✅ Test abgeschlossen")
|
||||
}
|
||||
Reference in New Issue
Block a user