From 67ee3fc0f2d2fbf8c7735a1dff7e33f55c589210 Mon Sep 17 00:00:00 2001 From: Vamshi Surabhi <0x777@users.noreply.github.com> Date: Sat, 29 Sep 2018 13:21:49 +0530 Subject: [PATCH] on a conn_init error send connection_err message instead of closing the ws conn (fix #537) (#572) --- server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs b/server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs index 290305bd76f..843f7a5479d 100644 --- a/server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs +++ b/server/src-lib/Hasura/GraphQL/Transport/WebSocket.hs @@ -262,8 +262,7 @@ onConnInit (L.Logger logger) manager wsConn authMode connParamsM = do res <- runExceptT $ getUserInfo logger manager headers authMode case res of Left e -> - liftIO $ WS.closeConn wsConn $ - BL.fromStrict $ TE.encodeUtf8 $ qeError e + sendMsg wsConn $ SMConnErr $ ConnErrMsg $ qeError e Right userInfo -> do liftIO $ IORef.writeIORef (_wscUser $ WS.getData wsConn) $ Just userInfo sendMsg wsConn SMConnAck