Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the Wrapped Gorilla Websocket connection by Gorilla Mux, does not work within the docker container. #758

Open
1 task done
mindwingx opened this issue May 3, 2024 · 0 comments
Labels

Comments

@mindwingx
Copy link

mindwingx commented May 3, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

the below Mux HandlerFunc works well.

func WsHandler(rw http.ResponseWriter, r *http.Request) {
	ws, err := upgradeConn.Upgrade(rw, r, nil)
	if err != nil {
		log.Println(err)
	}

	log.Println("connected to the ws ep.")

	conn := WsConn{ws}
	clients[conn] = WsConnDetail{}

	go WsListener(&conn)
}

Expected Behavior

but the WS connection is not available after building the application docker image and running the container.
image

Steps To Reproduce

docker-compose

version: "3.8"
services:

  core:
    container_name: webrtc_service
    build:
      context: .
      dockerfile: Dockerfile
    image: rtc
    restart: always
    ports:
      - "8080:8080"
    networks:
      - admin-service
```

### Anything else?

 Dockerfile

```
FROM golang:1.21.6

WORKDIR /app

COPY . .

ENV GO111MODULE on
ENV GOPROXY https://goproxy.cn

# RUN go test -v .

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o main presenter/main.go
RUN chmod +x main

CMD ["/app/main"]
```
@mindwingx mindwingx added the bug label May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant