anchor.diff:  %% handle_cast
   %% ------------------------------------------------------------------
   
  -handle_cast({send, tcp, Binary}, #state{tcp_socket = undefined} = State) ->
  -	?warning("Tried to send message over TCP before getting TCP sync info: ~p", Binary),
  -	{noreply, State};
  -
  -handle_cast({send, tcp, Binary}, State) ->
  -	Bin = netstring:encode(Binary),
  +handle_cast({send, tcp, Type, Channel, Json}, #state{tcp_socket = undefined} = State) ->
  +	?warning("Tried to send ~p message for channel ~p over TCP before getting TCP sync info: ~p", [Type, Channel, Json]),
  +	{noreply, State};
  +
  +handle_cast({send, tcp, Type, Channel, Json}, State) ->
  +	Bin = build_message(Type, Channel, Json),
   	gen_tcp:send(State#state.tcp_socket, Bin),
   	{noreply, State};
   
  -handle_cast({send, ssl, Binary}, State) ->
  -	#state{ssl_socket = Socket} = State,
  -	Bin = netstring:encode(Binary),
  -	ssl:send(Socket, Bin),
  -	{noreply, State};
  -
  -handle_cast({send, udp, Binary}, #state{udp_remote_info = undefined} = State) ->
  -	?warning("Tried to send message over UDP before getting UDP sync info: ~p", Binary),
  -	{noreply, State};
  -
  -handle_cast({send, udp, Binary}, State) ->
  +handle_cast({send, ssl, Type, Channel, Json}, State) ->
  +	Bin = build_message(Type, Channel, Json),
  +	ssl:send(State#state.ssl_socket, Bin),
  +	{noreply, State};
  +
  +handle_cast({send, udp, Type, Channel, Json}, #state{udp_remote_info = undefined} = State) ->
  +	?warning("Tried to send ~p message for channel ~p over UDP before getting TCP sync info: ~p", [Type, Channel, Json]),
  +	{noreply, State};
  +
  +handle_cast({send, udp, Type, Channel, Json}, State) ->
   	#state{udp_socket = Sock, udp_remote_info = {Ip, Port}} = State,
  -	gen_udp:send(Sock, Ip, Port, Binary),
  +	Bin = build_message(Type, Channel, Json),
  +	gen_udp:send(Sock, Ip, Port, Bin),
   	{noreply, State};
   
   handle_cast({set_tcp, Socket, Message, Bins, Cont}, State) ->
  
positive.code: set_tcp(Pid, Socket, Message, Bins, Cont) ->
  	gen_server:cast(Pid, {set_tcp, Socket, Message, Bins, Cont}).
  
  send(Pid, Socket, Binary) when Socket == udp; Socket == ssl; Socket == tcp ->
  	gen_server:cast(Pid, {send, Socket, Binary}).
  
  send_tcp(Pid, Binary) -> send(Pid, tcp, Binary).
  
  send_udp(Pid, Binary) -> send(Pid, udp, Binary).
  
  send_ssl(Pid, Binary) -> send(Pid, ssl, Binary).
  
  %% ------------------------------------------------------------------
  %% gen_server Function Definitions
  
negative.code: 	Type = proplists:get_value(<<"type">>, Props, <<>>),
  	Type0 = check_envelope_type(Type),
  	Id = proplists:get_value(<<"id">>, Props),
  	Contents = proplists:get_value(<<"contents">>, Props),
  	Channel = proplists:get_value(<<"channel">>, Props),
  	#envelope{type = Type0, id = Id, contents = Contents, channel = Channel}.
  
  check_envelope_type(<<"request">>) -> request;
  check_envelope_type(<<"response">>) -> response;
  