From 6de18f09e553c6f67c9ae4f4a53cf9f1d9622945 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 18 Jul 2020 16:45:10 -0700 Subject: [PATCH] Don't block websocket from handling another message when a long running proccess is triggered --- router/router_server_ws.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/router/router_server_ws.go b/router/router_server_ws.go index 4f60f93..f630240 100644 --- a/router/router_server_ws.go +++ b/router/router_server_ws.go @@ -51,8 +51,10 @@ func getServerWebsocket(c *gin.Context) { continue } - if err := handler.HandleInbound(j); err != nil { - handler.SendErrorJson(j, err) - } + go func(msg websocket.Message) { + if err := handler.HandleInbound(msg); err != nil { + handler.SendErrorJson(msg, err) + } + }(j) } }