
Hi there, I am writing a simple server which returns infinite stream of data to client like Twitter's streaming API. I have to manage the number of clients and the connection times of each one. So I have to handle disconnections during server sending a response to the client. I'm currently considering using wai (+warp) or snap framework. My code fragments for snap and wai are below: ==== snap ver. application ==== stream :: Application () stream = do req <- withRequest $ return . (rqRemoteAddr &&& rqRemotePort) writeLBS $ LBS.unlines $ map (LBS.pack . show) [1..] -- I have to handle disconnection here ==== end ==== ==== wai ver. ==== streamHandler :: Application streamHandler req = do return $ responseLBS statusOK [ ("Content-Type", "application/json") , ("Transfer-Encoding", "chunked") ] (LBS.unlines $ map (LBS.pack . show) [1..]) -- I have to handle disconnection here ==== end ==== Thanks, -- Hiromi ISHII