From 2863c8bfb5887f165a7a05431bf20efed5d44b33 Mon Sep 17 00:00:00 2001 From: Emyr298 Date: Sat, 29 Jun 2024 12:08:17 +0700 Subject: [PATCH] feat: add online players endpoint --- src/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.go b/src/main.go index ad88909..b1cd2b9 100644 --- a/src/main.go +++ b/src/main.go @@ -30,6 +30,12 @@ func main() { }) }) + router.GET("/players", func(context *gin.Context) { + context.JSON(http.StatusOK, map[string]interface{}{ + "players": clientHub.GetAllPlayerId(), + }) + }) + router.GET("/ws", func(context *gin.Context) { ws.ServeWebSocket(clientHub, context.Writer, context.Request) })