func (h *Handler) JoinRoom(c *gin.Context) {
claims := c.Request.Context().Value("jwt").(models.Claims) //couldn't find value with "jwt" key
fmt.Println(claims.ID, claims.Name)
cookie, err := c.Cookie("chartJWT") // allways err no cookie
if err != nil {
fmt.Printf("no cookie, error:%v\n", err)
}
fmt.Printf("cookie: %+v\n", cookie)
/*
conn, err := upgrader.Upgrade(c.Writer, c.Request, nil)
if err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
return
}
*/
Content-type: application/json; charset=utf-8
Set-Cookie: chartJWT=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjNlODVkMTFlLTg5ZTUtNDQxNC05YWRmLTVhNDU2NDZhMjE3YyIsIm5hbWUiOiJCb2IxICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIsImlzcyI6IjNlODVkMTFlLTg5ZTUtNDQxNC05YWRmLTVhNDU2NDZhMjE3YyIsImV4cCI6MTY4NjIyMzc4Mn0.hIqbXJjoodurJjuCxOygqTjusfInfr4iRTQf7gS7wBw; Path=/; Domain=localhost; Max-Age=86400; HttpOnly
Date: Wed, 07 Jun 2023 11:29:42 GMT
Length: 114
Name: chartJWT
Value: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjNlODVkMTFlLTg5ZTUtNDQxNC05YWRmLTVhNDU2NDZhMjE3YyIsIm5hbWUiOiJCb2IxICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICIsImlzcyI6IjNlODVkMTFlLTg5ZTUtNDQxNC05YWRmLTVhNDU2NDZhMjE3YyIsImV4cCI6MTY4NjIyMzc4Mn0.hIqbXJjoodurJjuCxOygqTjusfInfr4iRTQf7gS7wBw
Domain: localhost
Path: /
Expires: Thu, 08 Jun 2023 11:29:42 GMT
HTTP only: true
Secure: False
Error: Unexpected server response: 404
Handshake Details
Request URL: http://localhost:8080/ws/joinRoom/1
Request Method: GET
Status Code: 404 Not Found
Request Headers
Sec-WebSocket-Version: 13
Sec-WebSocket-Key: 0XKh7br3qTMNktQ/GrrRhA==
Connection: Upgrade
Upgrade: websocket
Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits
Host: localhost:8080
Response Headers
Content-Type: text/plain
Date: Wed, 07 Jun 2023 10:57:15 GMT
Content-Length: 18
RUN go build -o ./cmd/front-end_publisher main.go
выдет ошибку: FROM golang:1.19 as builder
WORKDIR /publisher
# Copy and download dependency using go mod
COPY ./modules/front-end/go.mod ./
COPY ./modules/front-end/go.sum ./
RUN go mod download
# Copy the code into the container
COPY ./modules/front-end ./
RUN go build -o ./cmd/front-end main.go
FROM alpine:3
COPY --from=builder main /bin/main
ENTRYPOINT ["/bin/main"]
# ls
cmd go.mod go.sum pkg front-end.Dockerfile
поменял, все равно не работает.
Только вручную прописывать куку, но я пока до конца не уверен правильно ли так должно быть.
Индус сказал, что когда фронт прикрутить все должно работать, хотя как-то слабо верится0