anchor.diff:  %
   %%%%%%%%%%%%%%%%%%%%%
   
  -%% @doc This function will start the websocket client
  -%%
  -%% This function will open a connection with the specified remote endpoint. Parameters
  -%% <ul>
  -%% <li>Host, a string. The URL of the remote endpoint</li>
  -%% <li>Port, an integer. The port where the remote endpoint is listening</li>
  -%% <li>Resouce, an string. The resource path where the websockets live</li>
  -%% </ul>
  --spec start(Host::string(), Port::integer(), Resource::string()) -> pid().
  +%% @doc Start the websocket client
  +%%
  +%% This is the same as calling {@link start/4} with the atom `wsecli' as its fourth parameter.
  +-spec start(
  +  Host :: string(),
  +  Port :: inet:port_number(),
  +  Resource :: string()
  +  ) -> pid().
   start(Host, Port, Path) ->
       start(Host, Port, Path, {local, ?DEFAULT_REG_NAME}).
   
  -%% @doc This function will start the websocket client
  -%%
  -%% This function will open a connection with the specified remote endpoint. Parameters
  -%% <ul>
  -%% <li>Host, a string. The URL of the remote endpoint</li>
  -%% <li>Port, an integer. The port where the remote endpoint is listening</li>
  -%% <li>Resouce, an string. The resource path where the websockets live</li>
  -%% <li>FsmName, a tuple or 'anon'. 'anon' will skip registering process. See also <a href="http://www.erlang.org/doc/man/gen_fsm.html#start_link-3">here</a></li>
  -%% </ul>
  --spec start(Host::string(), Port::integer(), Resource::string(), FsmName::tuple()|atom()) -> pid().
  +%% @doc Start the websocket client
  +%%
  +%% This function will open a connection with the specified remote endpoint building an URL like `ws://Host:PortResource'.
  +%% If the atom `anon' is given as the FsmName, the client will not be registered.
  +-spec start(
  +  Host     :: string(),
  +  Port     :: inet:port_number(),
  +  Resource :: string(),
  +  FsmName  :: client_name()
  +  ) -> pid().
   start(Host, Port, Path, anon) ->
     gen_fsm:start_link(?MODULE, {Host, Port, Path}, [{timeout, 5000}]);
   start(Host, Port, Path, FsmName) ->
  
positive.code: 
  -include_lib("wsock/include/wsock.hrl").
  
  -export([start/3, start/4, stop/0, stop/1, send/1, send/2]).
  -export([on_open/1, on_open/2, on_error/1, on_error/2, on_message/1, on_message/2, on_close/1, on_close/2]).
  -export([init/1, connecting/2, open/2, closing/2]).
  -export([handle_event/3, handle_sync_event/4, handle_info/3, terminate/3, code_change/4]).
  
negative.code: 
  %% @doc Send data to a remote endpoint
  %%
  %% This is the same as calling {@link send/2} with the atom `wsecli' (see {@link start/3}) as first parameter
  %%
  -spec send(
      Data::string()
    ) -> ok;
    (
      Data::binary()
    ) -> ok.
  send(Data) ->
    send(?DEFAULT_REG_NAME, Data).
  
  %% @doc Send data to a remote endpoint
  %%
  %% This is the same as calling {@link send/3} whit the third parameter being the type of the Data sent.
  %%
  -spec send(
    Socket :: pid() | atom(),
    Data :: binary()|string()
    ) -> ok.
  send(Socket, Data) when is_binary(Data) ->
    send(Socket, Data, binary);
  send(Socket, Data) when is_list(Data) ->
    send(Socket, Data, text).
  
  %% @doc Send data to a remote endpoint
  %%
  %% Sends data using the specified wsecli client, encoding the data as the give type.
  %%
  -spec send(
    Socket :: pid() | atom(),
    Data :: binary() | string(),
    Type :: encoding()
    ) -> ok.
  send(Socket, Data, Type) ->
    gen_fsm:send_event(Socket, {send, Data, Type}).
  
  %% @doc Add a callback to be called when a connection is opened
  %%
  