From 449b2054083f2d33bc5a04e7a6245418b8cce0ba Mon Sep 17 00:00:00 2001 From: Matt Branton Date: Tue, 10 Mar 2015 14:36:43 -0400 Subject: [PATCH] Websocket start_link now accepts binary string as URL option. Fixed start_link spec to include binary option on URL --- src/websocket_client.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/websocket_client.erl b/src/websocket_client.erl index fc17e39..dd22d58 100644 --- a/src/websocket_client.erl +++ b/src/websocket_client.erl @@ -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}} ->