Compare commits
1 Commits
b309dca688
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 393e26e8de |
@@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/gofiber/contrib/v3/websocket"
|
"github.com/gofiber/contrib/v3/websocket"
|
||||||
"github.com/gofiber/fiber/v3"
|
"github.com/gofiber/fiber/v3"
|
||||||
|
"github.com/google/uuid"
|
||||||
"github.com/vmihailenco/msgpack/v5"
|
"github.com/vmihailenco/msgpack/v5"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -230,7 +231,10 @@ func (h *Handler) handleTextMessage(s *session, data []byte) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handler) handleStart(s *session, msg ClientMsg) {
|
func (h *Handler) handleStart(s *session, msg ClientMsg) {
|
||||||
if msg.SessionID == "" || len(msg.SessionID) > 96 {
|
if msg.SessionID == "" {
|
||||||
|
msg.SessionID = uuid.NewString()
|
||||||
|
}
|
||||||
|
if len(msg.SessionID) > 96 {
|
||||||
h.sendError(s, "invalid_session", "invalid sessionId", false, "")
|
h.sendError(s, "invalid_session", "invalid sessionId", false, "")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user