question

Dylan Hunt avatar image
Dylan Hunt asked

How can I do something via cloudscript when a Photon event triggers, such as joining a room?

I'd like to cache the last known room for reconnections via PF cloudscript, but I've never worked with the event streams. I'm having trouble finding an example -- so alternately, if anyone has a link, that'd rock ~

If Photon event triggers to enter room, store the room number in PlayerInfo's LastKnownRoom, for example.

photon
10 |1200

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

1 Answer

·
brendan avatar image
brendan answered

Actually, the easiest thing to do would be to use the webhook system to write the room info via Cloud Script. There's an example ("RoomJoined") handler in our basic Cloud Script sample (revision 1 in all new titles).

10 |1200

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

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.