I have the following function to connect to a socket
initPhoenixSocket =
Phoenix.Socket.init socketUrl
|> Phoenix.Socket.withDebug
|> Phoenix.Socket.on "something" socketName DoSomething
|> Phoenix.Socket.on "somethingelse" socketName DoSomethingElse
and I am also then listening to the socket in the subscription with
subscriptions : Model -> Sub Msg
subscriptions model =
Phoenix.Socket.listen model.phxSocket PhoenixMsg
Looking through the documentation and the example code I cant see the best way to handle when the socket cannot successfully init (when the server is down etc.)
Looking through the source, it looks like there are a few functions that might help:
onError and onJoinError with the channel but I cant see anything on the initial socket. It looks like the websocket library exposes an error but I cant see a place to hook into it.
I have the following function to connect to a socket
and I am also then listening to the socket in the subscription with
Looking through the documentation and the example code I cant see the best way to handle when the socket cannot successfully init (when the server is down etc.)
Looking through the source, it looks like there are a few functions that might help:
onErrorandonJoinErrorwith the channel but I cant see anything on the initial socket. It looks like thewebsocketlibrary exposes an error but I cant see a place to hook into it.