Useful functions for building a PortMessage to be delivered through ports.
{ tag : String
, payload : Json.Encode.Value
}
new : String -> PortMessage
Create a new PortMessage with an empty payload.
new "SomeAction" == { tag = "SomeAction", payload = null }
withPayload : Json.Encode.Value -> PortMessage -> PortMessage
Attach a payload to the PortMessage
new "JoinChannel"
|> withPayload (Json.Encode.string "lobby")
== { tag = "JoinChannel", payload = "lobby" }