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)
}
