Azolo / websockex

An Elixir Websocket Client
MIT License
515 stars 97 forks source link

Doesn't terminate on connection errors #73

Closed floodico closed 5 years ago

floodico commented 5 years ago

Hello! That's how looks like my code:

def handle_disconnect(conn_status_map, state) do
  IO.inspect conn_status_map
  {:ok, state}
end

def terminate(reason, _state) do
  exit(:normal)
end

So when reason inside conn_map_status is {:remote, :closed}, it terminates perfectly. But how can i make it work when reason is %WebSockex.ConnError{original: :econnrefused} ?

Azolo commented 5 years ago

%WebSockex.ConnError{original: :econnrefused} is an error that occurs trying to negotiate the connection. I don't think it would ever trigger a disconnect event because there's no connection in the first place.