Possible bug in the objective-c code

VasilisVasilis
edited November 7 in Native
Hi,

I am trying to change the properties of a room, and I want all users to get the new properties.

I struggled a lot with the Photon code, and there is one thing that I do not understand. What is the purpose of the variable "webForward" in the next method ?

- (void) mergeCustomProperties:(NSDictionary*)customProperties :(bool)webForward


That method is in EGLoadBalancingRoom.mm file.

At the end of that method it says
if(![mCustomProperties isEqual:oldDict])
		[mLoadBalancingClient opSetPropertiesOfRoom:stripDict];
I believe that it should say
if(![mCustomProperties isEqual:oldDict])
		[mLoadBalancingClient opSetPropertiesOfRoom:mCustomProperties];		
because the properties are merged in the mCustomProperties at the line

[mCustomProperties addEntriesFromDictionary:stripDict];

When I made that change, I can update the value of a property.

Comments

  • Hi @Vasilis.

    What is the purpose of the variable "webForward" in the next method ?

    You should pass 'true' there if the properties should be forwarded to Webhooks, 'false' otherwise.
    See https://doc.photonengine.com/en-us/realtime/current/gameplay/web-extensions/webhooks for details about webhooks.


    At the end of that method it says

    if(![mCustomProperties isEqual:oldDict])
    [mLoadBalancingClient opSetPropertiesOfRoom:stripDict];

    I believe that it should say

    if(![mCustomProperties isEqual:oldDict])
    [mLoadBalancingClient opSetPropertiesOfRoom:mCustomProperties];

    because the properties are merged in the mCustomProperties at the line

    [mCustomProperties addEntriesFromDictionary:stripDict];

    This is not a bug, but intended. The client intentionally only sends the property changes to the server and not the result of those changes, because a) the server already knows hos the properties looked before those changes and can hence apply the changes itself, so we have to send less data and save bandwidth, and b) because the server might already have received a properties update from another client that has not yet arrived on this client when it sends its own update. Hence if the client would send the result of the changes to the server, then it would override the not yet known to it changes that came in from the other client.
  • VasilisVasilis
    edited November 8
    Hi @Kaiserludi,

    I thought that the variable webForward has to do something with the Webhooks, but, that method does not use that variable. In order to use it, the last line should be modified as follows:

    if(![mCustomProperties isEqual:oldDict]) [mLoadBalancingClient opSetPropertiesOfRoom:stripDict : webForward];

    Right now, I can not correctly update the room properties. Somehow (not all times), I lose all properties.
    I am really pleased to read that the server does keep track of the changes, and hence, I only need to send the update.
  • Hi @Vasilis.

    Your are correct. The 'webForward' flag indeed gets ignored for custom properties in the objective C client.

    However this does not have anything to do with the issues that you are experiencing. They must be caused by something else.
    Vasilis said:

    Somehow (not all times), I lose all properties.

    Then you need to find out in which situation exactly this does happen. Are you testing with just one client or with multiple clients? If it is the latter, then could it be that the other client removes those properties?

Sign In or Register to comment.