Skip to content

Handling Errors #19

@elliotstokes

Description

@elliotstokes

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions