aboutsummaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/Messages.elm24
1 files changed, 24 insertions, 0 deletions
diff --git a/client/src/Messages.elm b/client/src/Messages.elm
new file mode 100644
index 0000000..da10d22
--- /dev/null
+++ b/client/src/Messages.elm
@@ -0,0 +1,24 @@
+module Messages exposing(..)
+
+import Json.Decode
+import Json.Encode exposing (Value)
+-- The following module comes from bartavelle/json-helpers
+import Json.Helpers exposing (..)
+import Dict exposing (Dict)
+import Set exposing (Set)
+
+
+type ServerMessage =
+ Welcome
+
+jsonDecServerMessage : Json.Decode.Decoder ( ServerMessage )
+jsonDecServerMessage =
+ let jsonDecDictServerMessage = Dict.fromList [("Welcome", Welcome)]
+ in decodeSumUnaries "ServerMessage" jsonDecDictServerMessage
+
+jsonEncServerMessage : ServerMessage -> Value
+jsonEncServerMessage val =
+ case val of
+ Welcome -> Json.Encode.string "Welcome"
+
+