From 01be2797b2f43499b3307836eb333112ba6c3d5f Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Tue, 23 Jul 2024 08:36:04 +0900 Subject: [PATCH] do not use ctx provied from http request --- handlers.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/handlers.go b/handlers.go index 10fbb9d..8d0c1cb 100644 --- a/handlers.go +++ b/handlers.go @@ -343,9 +343,6 @@ func (s *Server) handleMessage(ctx context.Context, ws *WebSocket, message []byt } func (s *Server) HandleWebsocket(w http.ResponseWriter, r *http.Request) { - ctx := r.Context() - store := s.relay.Storage(ctx) - conn, err := upgrader.Upgrade(w, r, nil) if err != nil { s.Log.Errorf("failed to upgrade websocket: %v", err) @@ -375,6 +372,8 @@ func (s *Server) HandleWebsocket(w http.ResponseWriter, r *http.Request) { ctx, cancel := context.WithCancel(context.Background()) + store := s.relay.Storage(ctx) + // reader go func() { defer func() {