Events Being Received After Very Long Delay

So I am receiving all of the events I'm raising but in some cases can take up to 2 minutes for the event to be received. At the same time other events are being sent with the same options just a different code and I am receiving those.

Any thoughts on what might be going on here?

Best Answer

  • rexidecimal
    Accepted Answer

    So I finally figured it out. I Set up a helper function to parse event data into object arrays.

    ` public static object[] ConvertDataToArray(EventData photonEvent)

      {

        object[] data = { };

        try {

          data = (object[])photonEvent.CustomData;

          return data;

        }

        catch {

          return data;

        }

      }`


    I thought all event data was either null or an object array, I'm a web developer for a living so I was using 'object' as if it were 'any' in typescript. Which caused errors when trying to parse various photon events (also forgot about those😂) it threw an error which I caught but didn't log because I wrongfully assumed that any errors were just going to be null values. Since on error I return an empty object array the data that those events should of had was being cleared and somewhere that must have caused a fuckup with the events/connection/photon.

Answers

  • I'm calling Raise Event inside a coroutine is that a problem?

  • Tobias
    Tobias admin
    edited November 23

    Don't know. Does it produce issues?

    The delay is more likely due to the amount of data in the event.

    We'd need a minimal repro to look into this. No known issue delays events this long.

  • rexidecimal
    edited November 24


    So after a bit more digging this only happens when Raise Event is called inside of or from an update loop. Is that not allowed?

    EDIT: Switched to RPC which worked but now a different event is giving off the same behavior. Which makes me think I'm doing something to prime this behavior in some way?

    The Event is empty and I'm only sending maybe 10 events a minute so I don't think it's a data thing.

    Thanks for the reply I'll keep looking into it and if I can't figure it out I guess I'll try to break it out into a repo.

  • rexidecimal
    Accepted Answer

    So I finally figured it out. I Set up a helper function to parse event data into object arrays.

    ` public static object[] ConvertDataToArray(EventData photonEvent)

      {

        object[] data = { };

        try {

          data = (object[])photonEvent.CustomData;

          return data;

        }

        catch {

          return data;

        }

      }`


    I thought all event data was either null or an object array, I'm a web developer for a living so I was using 'object' as if it were 'any' in typescript. Which caused errors when trying to parse various photon events (also forgot about those😂) it threw an error which I caught but didn't log because I wrongfully assumed that any errors were just going to be null values. Since on error I return an empty object array the data that those events should of had was being cleared and somewhere that must have caused a fuckup with the events/connection/photon.

  • Glad you figured that out!

    Thanks for the update.