anchor.diff:  %% API Function Exports
   %% ------------------------------------------------------------------
   
  --export([start_link/2,start/2,udp/2,set_tcp/5,send/3,send_tcp/2,send_ssl/2,
  -	send_udp/2,json_to_envelope/1]).
  +-export([start_link/2,start/2,udp/2,set_tcp/5,send/5,json_to_envelope/1]).
   
   %% ------------------------------------------------------------------
   %% gen_server Function Exports
  
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: 	netstring:decode(Packet, Continuation).
  
  envelope_to_json(Envelope) ->
  	#envelope{type = Type, channel = Channel, contents = Contents, id = Id} = Envelope,
  	Props = [{<<"type">>, Type},
  		{<<"channel">>, Channel},
  		{<<"contents">>, Contents}
  	],
  	case Id of
  		undefined -> {struct, Props};
  		Id -> {struct, [{<<"id">>, Id} | Props]}
  	end.
  