Experiment with Authentication and Websockets
Some checks failed
build-docker-imge / Build the docker container (push) Failing after 2m24s

This commit is contained in:
2024-08-27 18:20:17 +02:00
parent 768c178218
commit 1e41dd833f
16 changed files with 687 additions and 0 deletions

20
middleware/ws.go Normal file
View File

@ -0,0 +1,20 @@
package middleware
import (
"github.com/gofiber/contrib/websocket"
"github.com/gofiber/fiber/v2"
)
type WsMiddleware struct {
}
func NewWsMiddleware() WsMiddleware {
return WsMiddleware{}
}
func (wm WsMiddleware) IsWebscoketUpgrade(ctx *fiber.Ctx) error {
if websocket.IsWebSocketUpgrade(ctx) {
return ctx.Next()
}
return ctx.SendStatus(fiber.StatusUpgradeRequired)
}