Hi all,
I’m building an application using the RealWorld example app as a guide, and I hit some odd issue.
I have my pageSubscriptions method to declare subscriptions based on the page we have loaded, like:
pageSubscriptions : Flags -> Page -> Sub Msg
pageSubscriptions flags page =
case page of
Blank ->
Sub.none
Errored _ ->
Sub.none
NotFound ->
Sub.none
Login _ ->
Sub.map ParseMessage (Login.subscriptions)
Where subscriptions does:
subscriptions = WebSocket.listen url
The problem is that, according to what I see in developer tools and the ‘events’ panel in Debug mode, subscriptions is called every minute or so, and that creates a new WebSocket connection. As a consequence, I end up with plenty of WebSocket connections open unless I refresh the page.
Has anyone seen this before? What’s the fix? I tried Google/SO/etc but couldn’t find any answer.
Cheers,
Pere