anchor.diff:         will_topic=WillTopic,
          will_msg=WillMsg} = Var,
   
  -    ClientId = get_random_clientid_if_empty(Id),
  -    io:format("--- Version ~p~n", [Version]),
  -    case check_version(Version) of
  -        true ->
  +    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,
  
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: clean_mp(MountPoint, MountedTopic) ->
      lists:sublist(MountedTopic, length(MountPoint) + 1, length(MountedTopic)).
  
  random_client_id() ->
      lists:flatten(["anon-", base64:encode_to_string(crypto:rand_bytes(20))]).
  
  