Skip to content

Commit 449b205

Browse files
author
Matt Branton
committed
Websocket start_link now accepts binary string as URL option.
Fixed start_link spec to include binary option on URL
1 parent 48c1186 commit 449b205

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/websocket_client.erl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
-type opts() :: [opt()].
1919

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

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

0 commit comments

Comments
 (0)