Haskell websocket closes after inactivity?

181 views Asked by At

I have a snippet which looks like this after connection is opened

receiveEvents :: WS.Connection -> Document -> IO()
receiveEvents conn document = forever $ do
        putStrLn "receive events"
        evnt <- WS.receiveData conn
        let val = fromJust $ decode' evnt
        liftIO $ atomically $ do
                              writeTChan (eventQueue document) val

If events are sent from client this code works, but after some inactivity connection is closed and i get an error on client (web javascript) connection is closed (onclose of websockets is called). Does websockets close after some inactivity. Also if this is in main thread it works fine?

0

There are 0 answers