this is expected.. it's possible for the data message to be delivered earlier than the participant's metadata.
when that happens, you are left with one of three paths:
• drop the message
• deliver it without participant metadata
• keep an internal queue to wait for metadata to come
we are currently doing 2
d
dry-farmer-50272
08/05/2023, 9:28 PM
so how can I achieve option 3 ?
can you provide an example for that please ?🙁
in other words ,
as you said sometimes onDataReceived will be triggered first and sometimes OnUserConnected will be triggered first,
so how can we ensure that rp in onDataReceived always is not nil ? 🤔
d
dry-elephant-14928
08/06/2023, 6:50 AM
you'd have to modify the SDK to change that logic unfortunately.. or another option is to encapsulate the participant identity inside of your payload, so you are not reliant on the participant parameter being filled out first.
d
dry-farmer-50272
08/06/2023, 12:44 PM
So I tried to do like this :
If OnDataReceived called first then I will call OnDataReceived again in OnUserConnected with the rp that I got in that method
if OnUserConnected called first then I call OnDataReceived in itself again when I find the user that I added to users list in OnUserConnected
again with the rp that I got in that method
and now it almost working ...