Skip to content
This repository was archived by the owner on Nov 7, 2018. It is now read-only.
This repository was archived by the owner on Nov 7, 2018. It is now read-only.

websocket_client: how can I detect if server is down while connecting? #4

@goberman

Description

@goberman

If I call websocket_client:start(Host, Port, ?MODULE), but server is not running, the API generates exception:
** exception exit: {badmatch,{error,econnrefused}}
in function websocket_client:init/1 (d:/DAVEBR~1/src/websocket_client.erl, line 46)
in call from gen_server:init_it/6 (gen_server.erl, line 297)
in call from proc_lib:init_p_do_apply/3 (proc_lib.erl, line 227)

It would be nice to have some callback invoked when connection cannot be established.
Is there any way to catch this exception in my code?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions