19

I am working through the elm guide.

In the effects subchapter there is an example with a Time-subscription

subscriptions : Model -> Sub Msg
subscriptions model =
  Time.every second Tick

and an example which handles Web-Sockets-subscriptions

subscriptions : Model -> Sub Msg
subscriptions model =
  WebSocket.listen "ws://echo.websocket.org" NewMessage

But in these examples, there is only ever one subscription. How could I handle multiple subscriptions?

glennsl
  • 28,186
  • 12
  • 57
  • 75
DanEEStar
  • 6,140
  • 6
  • 37
  • 52

1 Answers1

29

You may use Sub.batch, providing a list of subscriptions, it returns a batched subscription

Reference:

Ben Hoyt
  • 10,694
  • 5
  • 60
  • 84
rstar
  • 1,006
  • 1
  • 8
  • 14