Platform.Sub

type Sub msg
A subscription is a way of telling Elm, “Hey, let me know if anything interesting happens over there!” So if you want to listen for messages on a web socket, you would tell Elm to create a subscription. If you want to get clock ticks, you would tell Elm to subscribe to that.

The cool thing here is that this means Elm manages all the details of subscriptions instead of you. So if a web socket goes down, you do not need to manually reconnect with an exponential backoff strategy, Elm does this all for you behind the scenes!

Every Sub specifies (1) which effects you need access to and (2) the type of messages that will come back into your application.

map : (a -> msg) -> Sub a -> Sub msg
batch : List (Sub msg) -> Sub msg
none : Sub msg