ownerIDSelfDidChange question

`Action<RealtimeView, int> ownerIDSelfDidChange
`Action<RealtimeView, int> ownerIDSelfDidChange
Does this fire when no one owns the realtime view. If so what is the int the ID will be returned as
3 Replies
kapa.ai
kapa.ai2d ago
Hi @JimJamesJimJim. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, the ownerIDSelfDidChange event fires when the ownership of a RealtimeView changes, including when it becomes unowned. When no one owns the RealtimeView, the int parameter (representing the new owner ID) will be -1. This behavior is consistent across RealtimeView, RealtimeComponent, and RealtimeModel, as they all have similar ownership properties. According to the RealtimeModel reference:
The client ID of the model owner. If the model is unowned, this returns -1.
So, when the RealtimeView becomes unowned, the ownerIDSelfDidChange event will fire with -1 as the new owner ID. It's worth noting that you can also check the ownership status using the isUnownedSelf property, which will be true when the RealtimeView is not owned by any client, as mentioned in the RealtimeView reference:
isUnownedSelf: True if the component is not owned by any client.
This property can be useful in conjunction with the ownerIDSelfDidChange event to manage ownership-related logic in your application. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2d ago
<@351655082145611778> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
JimJamesJimJim
JimJamesJimJimOP2d ago
Nice one bot

Did you find this page helpful?