question

Denzie Gray avatar image
Denzie Gray asked

Photon RoomClosed not working

@SethDu @https://community.playfab.com/users/27/brendan.html @Hamza Lazaar @JayZuo I have been using RoomClosed via Photon network but the problem is that it doesn't always trigger when all users leave the room.

Sometimes it works and other times only RoomLeft will be called.

photonwebhooks
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Denzie Gray avatar image
Denzie Gray answered

Ok, I was able to find the error. Thank you so much. I was accessing the 'currentPlayerId' in the debuglog and it is undefined in PathClose so it threw a silent error.

Again, thank yo so much!

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Gosen Gao avatar image
Gosen Gao answered

According to Photon docs, they mention that “In case IsPersistent is set to true, Photon Cloud will send the State which is a serialized snapshot of the room that contains its properties and information about the actors and cached events.” Probably this data is too large that exceeds the PlayStream events body size, the default limit is 10,000 bytes.

They also mention that “This hook(RoomClosed) is fired just before removing a room instance from memory in the Photon Cloud. This happens only when the EmptyRoomTTL has expired.” Have you configured the EmptyRoomTTL?

11 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Denzie Gray avatar image Denzie Gray commented ·

I have tried a TTL or 1000 and a TTL of 0. Additionally, the state is an empty room state object with no data other than the TTL.

If the limit for the playstream is being reached then wouldn't I get a limit exception in the logs?

I have a playstream write event in the method and it doesn't get called either and I don't get an API limit error.

0 Likes 0 ·
Denzie Gray avatar image Denzie Gray commented ·

I tried 0 and 1000 for the EmptyRoomTTL and it still doesn't fire. Additionally the size of the state is about 2000 bytes max. Also, the room leave call always triggers correctly.

I don't see any API limit exceptions or the size limit exceptions.

0 Likes 0 ·
Gosen Gao avatar image Gosen Gao Denzie Gray commented ·

In my tests, it works fine. May I know your RoomClosed handler?

5511-2023-02-10-155736.png

0 Likes 0 ·
Denzie Gray avatar image Denzie Gray Gosen Gao commented ·

Do you mean the logic of the handle?

I am calling a log method in the handle. Or do you mean how the handle is being attached to the process?

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.