Skip to content

Commit

Permalink
Websocket start_link now accepts binary string as URL option.
Browse files Browse the repository at this point in the history
Fixed start_link spec to include binary option on URL
  • Loading branch information
Matt Branton committed Mar 10, 2015
1 parent 48c1186 commit 449b205
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/websocket_client.erl
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
-type opts() :: [opt()].

%% @doc Start the websocket client
-spec start_link(URL :: string(), Handler :: module(), HandlerArgs :: list()) ->
-spec start_link(URL :: string() | binary(), Handler :: module(), HandlerArgs :: list()) ->
{ok, pid()} | {error, term()}.
start_link(URL, Handler, HandlerArgs) ->
start_link(URL, Handler, HandlerArgs, []).

start_link(URL, Handler, HandlerArgs, AsyncStart) when is_boolean(AsyncStart) ->
start_link(URL, Handler, HandlerArgs, [{async_start, AsyncStart}]);
start_link(URL, Handler, HandlerArgs, Opts) when is_binary(URL) ->
start_link(erlang:binary_to_list(URL), Handler, HandlerArgs, Opts);
start_link(URL, Handler, HandlerArgs, Opts) when is_list(Opts) ->
case http_uri:parse(URL, [{scheme_defaults, [{ws,80},{wss,443}]}]) of
{ok, {Protocol, _, Host, Port, Path, Query}} ->
Expand Down

0 comments on commit 449b205

Please sign in to comment.