anchor.diff:      {next_state, connected, State#state{msgid='++'(MsgId), waiting_acks=store(Key, {Ref, {unsubscribe, Topics}},
           WAcks), info_fun=NewInfoFun}};
   
  -connected({publish, Topic, Payload, QoS, Dup}, #state{msgid=MsgId} = State) ->
  -    {next_state, connected, send_publish(MsgId, Topic, Payload, QoS, Dup, State#state{msgid='++'(MsgId)})};
  -
  -connected({publish, MsgId, Topic, Payload, QoS, _}, State) ->
  +connected({publish, Topic, Payload, QoS, Retain, Dup}, #state{msgid=MsgId} = State) ->
  +    {next_state, connected, send_publish(MsgId, Topic, Payload, QoS, Retain, Dup, State#state{msgid='++'(MsgId)})};
  +
  +connected({publish, MsgId, Topic, Payload, QoS, Retain, _}, State) ->
       %% called in case of retry
  -    {next_state, connected, send_publish(MsgId, Topic, Payload, QoS, true, State)};
  +    {next_state, connected, send_publish(MsgId, Topic, Payload, QoS, Retain, true, State)};
   
   connected({retry, Key}, #state{transport={Transport,_}, sock=Sock, waiting_acks=WAcks,
       retry_interval=RetryInterval} = State) ->
  
positive.code:         0 ->
              State#state{info_fun=NewInfoFun};
          _ ->
              Msg = {publish, MsgId, Topic, Payload, QoS, true},
              Key = {publish, MsgId},
              Ref = gen_fsm:send_event_after(RetryInterval, {retry, Key}),
              State#state{waiting_acks=store(Key, {Ref, Msg}, WAcks),
  
negative.code:     subscribe/3,
      unsubscribe/2,
      publish/4,
      publish/5,
      disconnect/1,
      call/2,
      cast/2]).
  