anchor.diff:  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   %%% INTERNAL
   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  -
  -check_version(3) -> true;
  -check_version(4) -> true;
  -check_version(_) -> false.
  +check_version(Id, Version) ->
  +    case {Id, Version} of
  +        {"", 4} -> {ok, random_client_id()};
  +        {"", 3} -> {error, ?CONNACK_INVALID_ID};
  +        {_, 4} -> {ok, Id};
  +        {_, 3} -> {ok, Id};
  +        _ -> {error, ?CONNACK_PROTO_VER}
  +    end.
   
   send_connack(ReturnCode, State) ->
       send_frame(?CONNACK, #mqtt_frame_connack{return_code=ReturnCode},
  
positive.code:                     {connection_attempted,
                       send_connack(?CONNACK_AUTH, State)}
              end;
          false ->
              {connection_attempted,
               send_connack(?CONNACK_PROTO_VER, State)}
      end;
  
  handle_frame(connected, #mqtt_frame_fixed{type=?PUBACK}, Var, _, State) ->
  
negative.code:        will_topic=WillTopic,
         will_msg=WillMsg} = Var,
  
      case check_version(Id, Version) of
          {ok, ClientId} ->
              %% auth_on_register hook must return either:
              %%  ok | next | {error, invalid_credentials | not_authorized}
              User1 = case User of "" -> undefined; _ -> User end,
  