Comments (3)
I did some tests, and I was able to reproduce in some cases (although not reliably).
Is is possible that the state is actually sent, but instead the other client has not yet completed its join?
To explain further, take this timed sequence:
- Socket 1 receives matched event
- Socket 2 receives matched event
- Socket 1 ask to join
- Socket 2 ask to join
- Socket 1 join complete (it is now participating in the match)
- Socket 1 send the state (but socket 2 is not yet participating)
- Socket 2 join complete (it is now participating in the match)
- Socket 2 send the state (socket 1 is participating, so it receives the sent state)
When events happen in this order, socket 2 will not receive the state from socket 1 since when it was sent, socket 2 join had yet to complete.
Can you confirm from your server log that the message is not actually sent? Or is it just not received from the other client? Can you provide a server log when this happen?
See my log for when I'm able to reproduce:
nakama | {"level":"debug","ts":"2020-05-12T10:18:29.432Z","msg":"Sending *rtapi.Envelope_Match message","uid":"b48e37c2-120c-4b47-9690-c05adb6a1ca4","sid":"b578c46d-98c3-407e-828c-4be170875299","envelope":"cid:\"2\" match:<match_id:\"1f301c43-e474-423a-9fa7-953efad009c5.\" self:<user_id:\"b48e37c2-120c-4b47-9690-c05adb6a1ca4\" session_id:\"b578c46d-98c3-407e-828c-4be170875299\" username:\"QtWAlPPMeT\" > > "}
nakama | {"level":"debug","ts":"2020-05-12T10:18:29.432Z","msg":"Processing presence event","joins":1,"leaves":0}
nakama | {"level":"debug","ts":"2020-05-12T10:18:29.439Z","msg":"Received *rtapi.Envelope_MatchDataSend message","uid":"b48e37c2-120c-4b47-9690-c05adb6a1ca4","sid":"b578c46d-98c3-407e-828c-4be170875299","cid":"3","message":{"MatchDataSend":{"match_id":"1f301c43-e474-423a-9fa7-953efad009c5.","op_code":1,"data":"eyJhIjoxfQ=="}}}
nakama | {"level":"debug","ts":"2020-05-12T10:18:29.442Z","msg":"Received *rtapi.Envelope_MatchJoin message","uid":"b48e37c2-120c-4b47-9690-c05adb6a1ca4","sid":"ec0057c7-0a2d-40e3-be4b-23a4d5a653db","cid":"2","message":{"MatchJoin":{"Id":{"Token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1ODkyNzg3MzksIm1pZCI6IjFmMzAxYzQzLWU0NzQtNDIzYS05ZmE3LTk1M2VmYWQwMDljNS4ifQ.-Ckhfc_Pr2Jjdi-rR6jQeqOXXqwcvsL3QKXelTXsE2I"}}}}
nakama | {"level":"debug","ts":"2020-05-12T10:18:29.442Z","msg":"Processing presence event","joins":1,"leaves":0}
nakama | {"level":"debug","ts":"2020-05-12T10:18:29.442Z","msg":"Sending *rtapi.Envelope_Match message","uid":"b48e37c2-120c-4b47-9690-c05adb6a1ca4","sid":"ec0057c7-0a2d-40e3-be4b-23a4d5a653db","envelope":"cid:\"2\" match:<match_id:\"1f301c43-e474-423a-9fa7-953efad009c5.\" size:1 presences:<user_id:\"b48e37c2-120c-4b47-9690-c05adb6a1ca4\" session_id:\"b578c46d-98c3-407e-828c-4be170875299\" username:\"QtWAlPPMeT\" > self:<user_id:\"b48e37c2-120c-4b47-9690-c05adb6a1ca4\" session_id:\"ec0057c7-0a2d-40e3-be4b-23a4d5a653db\" username:\"QtWAlPPMeT\" > > "}
nakama | {"level":"debug","ts":"2020-05-12T10:18:29.445Z","msg":"Received *rtapi.Envelope_MatchDataSend message","uid":"b48e37c2-120c-4b47-9690-c05adb6a1ca4","sid":"ec0057c7-0a2d-40e3-be4b-23a4d5a653db","cid":"3","message":{"MatchDataSend":{"match_id":"1f301c43-e474-423a-9fa7-953efad009c5.","op_code":1,"data":"eyJhIjoxfQ=="}}}
As you can see the server receives Envelope_MatchDataSend
from the first client before the Envelope_MatchJoin
from the second client.
from nakama-godot.
Is is possible that the state is actually sent, but instead the other client has not yet completed its join?
Yes, there does seem to be a race condition here, I enabled debug output and the message is received before the second client has joined, the reason why this doesn't seem to happen with two desktop clients is probably that they take the same amount of time to join.
In hindsight it's obvious that after join_matched_async()
returns it's not guaranteed that everyone joined, but I didn't think of that at first.
I guess there's no problem with the API then.
from nakama-godot.
I'll close the issue then.
Keep in mind that you can probably use the received_match_presence
event (along with the presences in the Match
object returned by the join) to know when everybody has connected.
from nakama-godot.
Related Issues (20)
- Parse error: Could not find type "p_type" in current scope. HOT 3
- Network ridiculously slow HOT 3
- "Array cannot be null" error when making RPC call in C# using GodotHttpAdapter HOT 1
- Nakama does not work for Godot 4.0 HOT 3
- Socket is not working with Godot 4 HOT 2
- Update tutorials for Godot 4 HOT 3
- Nakama plugin not visible in Godot 4.0.3 HOT 3
- Method return value cannot match type, Causing errors in Godot4.0. HOT 1
- NakamaMultiplayerBridge with Authoritative HOT 4
- Nakama Server Disconnection Issue with Fifth Player in Godot Engine Game HOT 1
- All NakamaSocket methods fail with 'Request cancelled.' HOT 6
- Add match_label API
- Game crashes on HTTP request HOT 3
- Pass Error Information to Godot 4 client
- Question - RPG/OpenWorld style multiplayer
- Party presence event is not received by client when party is created HOT 3
- p_create arguments authenticate_email_async doesn't work HOT 1
- Export on exe not working with server connections
- Getting Request 1 failed with result: 13, response code: 0 on client.authenticate_email_async(email, password) HOT 4
- Metadata is supported for relayed matches, but I can't create a new match with metadata, only joining is possible. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nakama-godot.