aboutsummaryrefslogtreecommitdiffstats
path: root/src/Reaktor/Plugins/Ping.hs
blob: 07aae9eff3b6f853e675da5f56e2db91ae5e3fc6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
module Reaktor.Plugins.Ping where

import Prelude.Extended
import Reaktor

new :: Actions -> IO (Message -> IO ())
new Actions{..} =
    return $ \case
      Message _ cmd args ->
        when (cmd == PING) $
          aSend (Message Nothing PONG args)
      _ -> pure ()