File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,8 @@ postgresWsMiddleware =
47
47
compose = (.) . (.) . (.) . (.) . (.)
48
48
49
49
-- private functions
50
+ jwtExpirationStatusCode :: Word16
51
+ jwtExpirationStatusCode = 3001
50
52
51
53
-- when the websocket is closed a ConnectionClosed Exception is triggered
52
54
-- this kills all children and frees resources for us
@@ -73,7 +75,7 @@ wsApp getTime dbChannel secret pool multi pendingConn =
73
75
WS. withPingThread conn 30 (pure () ) $ do
74
76
case M. lookup " exp" validClaims of
75
77
Just (A. Number expClaim) -> do
76
- connectionExpirer <- newAlarmClock $ const (WS. sendClose conn (" JWT expired" :: ByteString ))
78
+ connectionExpirer <- newAlarmClock $ const (WS. sendCloseCode conn jwtExpirationStatusCode (" JWT expired" :: ByteString ))
77
79
setAlarm connectionExpirer (posixSecondsToUTCTime $ realToFrac expClaim)
78
80
Just _ -> pure ()
79
81
Nothing -> pure ()
You can’t perform that action at this time.
0 commit comments