runRtmBot :: (Z () -> IO ()) -> T.Text -> (Event -> Z ()) -> IO ()
runRtmBot runIO token directives = do
  (host, path) <- getSlackWebsocket token
  SSL.withOpenSSL $ do
    stream <- getStreamForWebsocket host
    WS.runClientWithStream stream host path WS.defaultConnectionOptions [] wsApp
  where
    wsApp ws = do
      WS.forkPingThread ws 10
      runIO . forever $ handleEvents directives ws
runRtmBot :: (Z () -> IO ()) -> T.Text -> (Event -> Z ()) -> IO ()
runRtmBot runIO token directives = do
  (host, path) <- getSlackWebsocket token
  SSL.withOpenSSL $ do
    stream <- getStreamForWebsocket host
    WS.runClientWithStream stream host path WS.defaultConnectionOptions [] wsApp
  where
    wsApp ws = do
      WS.forkPingThread ws 10
      runIO . forever $ handleEvents directives ws
runRtmBot runIO token directives = do
  (host, path) <- getSlackWebsocket token
  SSL.withOpenSSL $ do
    stream <- getStreamForWebsocket host
    WS.runClientWithStream stream host path WS.defaultConnectionOptions [] wsApp
  where
    wsApp ws = do
      WS.forkPingThread ws 10
      runIO . forever $ handleEvents directives ws