anchor.diff:  			Else
   	end.
   
  +%% @doc Send a message as text. @see send/3.
  +-spec send(Socket :: websocket(), Msg :: binary()) -> 'ok'.
   send(Socket, Msg) ->
   	send(Socket, Msg, text).
   
  +%% @doc Send a message as the given type.
  +-spec send(Socket :: websocket(), Msg :: binary(), Type :: message_type()) -> 'ok'.
   send(Socket, Msg, Type) ->
   	gen_fsm:sync_send_all_state_event(Socket, {send, Type, Msg}).
   
  +%% @doc recv/2 with an infinte timeout. @see recv/2
  +-spec recv(Socket :: websocket()) -> {'ok', frame()}.
   recv(Socket) ->
   	recv(Socket, infinity).
   
  +%% @doc Get a single frame from the socket, giving up after the timeout.
  +-spec recv(Socket :: websocket(), Timeout :: timeout()) -> {'ok', frame()} | {'error', 'timeout'}.
   recv(Socket, Timeout) ->
   	gen_fsm:sync_send_event(Socket, {recv, Timeout}).
   
  +%% @doc set the controlling process to a new owner. Can only suceede if
  +%% called from the current owner.
  +-spec controlling_process(Socket :: websocket(), NewOwner :: pid()) -> 'ok' | {'error', 'not_owner'}.
   controlling_process(_Socket, _NewOwner) ->
   	?debugMsg("controlling_process"),
   	{error, nyi}.
   
  +%% @doc Close the socket without exiting the process created on socket
  +%% connect.
  +-spec close(Socket :: websocket()) -> 'ok'.
   close(_Socket) ->
   	?debugMsg("close"),
   	{error, nyi}.
   
  +%% @doc Close the socket and shut it down with the given reason.
  +-spec shutdown(Socket :: websocket(), How :: term()) -> 'ok'.
   shutdown(_Socket, _How) ->
   	?debugMsg("shutdown"),
   	{error, nyi}.
   
  +%% @doc Set the given options on the given socket.
  +-spec setopts(Socket :: websocket(), Opts :: connect_opts()) -> 'ok'.
   setopts(Socket, Opts) ->
   	gen_fsm:sync_send_all_state_event(Socket, {setopts, Opts}).
   
  +%% @private
   %% gen_fsm api
   init([Controller, Url, _Opts, Timeout]) ->
   	?debugMsg("gen_fsm init"),
  
positive.code: 			{reply, {error, badarg}, Statename, State}
  	end;
  
  handle_sync_event({send, Type, Msg}, From, Statename, State) when Statename =:= active; Statename =:= active_once; Statename =:= passive ->
  	?debugFmt("A send event of type ~p for msg ~p", [Type, Msg]),
  	#state{transport = Trans, socket = Socket} = State,
  
negative.code: 	gen_fsm:reply(From, {error, timeout}),
  	{stop, normal, State}.
  
  %% @private
  active({recv, _Timeout}, _From, State) ->
  	{reply, {error, not_passive}, active, State};
  
  