Skip to content

Commit

Permalink
Merge pull request #39 from mbrix/master
Browse files Browse the repository at this point in the history
very minor, init accepts binary strings
  • Loading branch information
jeremyong committed Mar 10, 2015
2 parents 48c1186 + 449b205 commit f465f22
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 f465f22

Please sign in to comment.