anchor.diff:      | {username, binary() | iolist()}
       | {password, binary() | iolist()}
       | {will, topic(), payload(), qos_level(), boolean()}
  -    | {will, topic(), payload()}).
  +    | {will, topic(), payload()}
  +    | {clean_session, boolean()}
  +    | clean_session).
   
   -spec(connect_opt(#connect{}, connect_option()) -> #connect{}).
   connect_opt(C, {client_id, Id}) ->
  
positive.code: do_rpc(S0, Req, Ref, From) ->
      #state{ id_counter = Id,
              rpcs = RPC } = S0,
      RPC1 = gb_trees:insert(?LOCAL(Id), {Ref, From}, RPC),
      write(S0, with_id(Id, Req)),
      S0#state{ id_counter = Id + 1, rpcs = RPC1 }.
  
  with_id(Id, S = #subscribe{})   -> S#subscribe{ message_id = Id };
  with_id(Id, U = #unsubscribe{}) -> U#unsubscribe{ message_id = Id }.
  
  make_reply(#suback{ message_id = Id, qoses = QoSes }) ->
      {Id, {suback, QoSes}};
  make_reply(#unsuback{ message_id = Id }) ->
      {Id, unusback}.
  
  %% Send and possibly record the fact of an acknowledgment
  do_ack(S, #publish{ qos = QoS }) ->
      case QoS of
          at_most_once ->
  
negative.code:                          self ! {tcp, Sock, More},
                           S2
                   end,
              S4 = resend_or_reset(S3),
              {reply, ok, opened, S4};
          {ok, #connack{ return_code = Else }, _Rest, S1} ->
              E = {connection_refused, Else},
              {stop, E, {error, E}, S1};
  