Before I explain a fine example, feel free to tell me the answer is "Buy the source"; I suspect that.. could be the case. If it is, I totally respect that. Maybe you'll receive a large check in the mail.
In my current game (a real-time, persistent strategy game deployed on Facebook), we need to transfer room variable ownership whenever the room owner decides to quit/logoff. It took a coon's age to determine that the server-side execution of..
Code: Select all
SFSApi::leaveRoom(User user,
Room room,
boolean fireClientEvent,
boolean fireServerEvent).. which is pretty self explanatory. Maybe its out of bounds to mention that room vars owned by that user are deleted here as well, or maybe that's documented elsewhere (and I just couldn't find it).Removes a User from a previously joined Room
In hindsight, I realize I should have intuitively thought to change variable ownership upon receiving a LeaveRoomRequest rather than a SFSEvent.USER_LEAVE_ROOM, but didn't, thinking to save time not having to write yet another request handler and also knowing I had access to the SFS user in my USER_LEAVE_ROOM callback.
I almost deleted this post after realizing that last bit, its more my fault than anything.. but I'll post it anyways, in case it helps others or sparks some discussion.