From c6da3d17a1f258f2efbfcbca67eebbf70892cd33 Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Sun, 15 Dec 2024 11:24:51 -0700 Subject: [PATCH] refactor pushing state over websocket into a func --- cmd/server/ws.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/server/ws.go b/cmd/server/ws.go index 91cc414..09d7e6d 100644 --- a/cmd/server/ws.go +++ b/cmd/server/ws.go @@ -29,10 +29,10 @@ func (s *S) serveWS(w http.ResponseWriter, r *http.Request) error { } defer c.CloseNow() ws := WS{S: s, c: c} - return ws.serve(w, r) + return ws.Serve(w, r) } -func (ws WS) serve(w http.ResponseWriter, r *http.Request) error { +func (ws WS) Serve(w http.ResponseWriter, r *http.Request) error { ctx, can := context.WithCancel(r.Context()) defer can() r = r.WithContext(ctx)