ttn-client 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+10/−10 lines, 2 files
Files
- src/Data/TTN/Client.hs +9/−9
- ttn-client.cabal +1/−1
src/Data/TTN/Client.hs view
@@ -128,18 +128,18 @@ , MQTT.cPassword = Just appKey } - _ <- forkIO $ do- qosGranted <- MQTT.subscribe conf [(topic, MQTT.Handshake)]- case qosGranted of- [MQTT.Handshake] -> forever $ atomically (readTChan pubChan) >>= (mqttHandleChan chan)- _ -> do- hPutStrLn stderr $ "Wanted QoS Handshake, got " ++ show qosGranted- exitFailure-- -- this will throw IOExceptions, how do we reconnect? forever $ do+ tID <- forkIO $ do+ qosGranted <- MQTT.subscribe conf [(topic, MQTT.Handshake)]+ case qosGranted of+ [MQTT.Handshake] -> forever $ atomically (readTChan pubChan) >>= (mqttHandleChan chan)+ _ -> do+ hPutStrLn stderr $ "Wanted QoS Handshake, got " ++ show qosGranted+ exitFailure+ terminated <- MQTT.run conf hPutStrLn stderr $ "Terminated, restarting. Reason: " ++ show terminated+ killThread tID mqttHandleChan :: TChan Event -> MQTT.Message MQTT.PUBLISH -> IO () mqttHandleChan chan msg = do
ttn-client.cabal view
@@ -1,5 +1,5 @@ name: ttn-client-version: 0.1.0.0+version: 0.1.0.1 synopsis: TheThingsNetwork client description: Connect to TTN MQTT API, receive and decode messages homepage: https://github.com/sorki/ttn-client