-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Socket connection to group chat problem #58
Comments
@SinaZK Can you share what your GDScript code looks like when you get this error? |
Sure. |
Nakama server logs: `nakama | {"level":"info","ts":"2020-11-10T12:43:03.914Z","caller":"server/session_ws.go:80","msg":"New WebSocket session connected","uid":"20a96d58-4d6f-4338-b487-2bfc10b7a43d","sid":"46542092-2352-11eb-838e-7106fdcb5b46","format":0} nakama | {"level":"debug","ts":"2020-11-10T12:43:12.522Z","caller":"server/pipeline.go:62","msg":"Received *rtapi.Envelope_ChannelJoin message","uid":"20a96d58-4d6f-4338-b487-2bfc10b7a43d","sid":"46542092-2352-11eb-838e-7106fdcb5b46","cid":"1","message":{"ChannelJoin":{"target":"bf5052a9-948c-473b-b81e-ccf76d28126a","type":3,"persistence":{"value":true},"hidden":{}}}} nakama | {"level":"debug","ts":"2020-11-10T12:43:12.526Z","caller":"server/session_ws.go:390","msg":"Sending *rtapi.Envelope_Channel message","uid":"20a96d58-4d6f-4338-b487-2bfc10b7a43d","sid":"46542092-2352-11eb-838e-7106fdcb5b46","envelope":"cid:"1" channel:{id:"3.bf5052a9-948c-473b-b81e-ccf76d28126a.." self:{user_id:"20a96d58-4d6f-4338-b487-2bfc10b7a43d" session_id:"46542092-2352-11eb-838e-7106fdcb5b46" username:"QdcBVBRWvL" persistence:true} group_id:"bf5052a9-948c-473b-b81e-ccf76d28126a"}"} nakama | {"level":"debug","ts":"2020-11-10T12:43:12.526Z","caller":"server/tracker.go:672","msg":"Processing presence event","joins":1,"leaves":0}` |
@SinaZK Looks like the issue is with how the type is validated when created for the I think the serializer needs a small tweak to recognise that the presences can be an empty array if omitted by the server. Can you open a pull request for the change? |
Thanks for your response. I set the required to false at it solved the issue. Is this the proper way to handle this issue? |
@SinaZK I think it depends. Ideally we'd want to instruct the serializer to ensure that if the field is not present it just uses a default value as an empty array. The change you've made will actually tell the serializer to leave the field as I'm not sure whether its possible to set the serializer to use the empty array as the default value when the field is not found in the JSON to be parsed, Fabio will be able to help us though. How would you handle this constraint @Faless? |
@novabyte we could define a getter that uses another variable (if it's limited to this specific case): const _SCHEMA = {
#[...]
"presences": {"name": "_presences", "type": TYPE_ARRAY, "required": false, "content": "UserPresence"},
#[...]
}
#[...]
# The presences visible on the chat channel.
var presences : Array setget , _get_presences # of objects NakamaUserPresence
var _presences : Array = null
func _get_presences():
return Array() if not _presences is Array else _presences Or alternatively we could add an optional "default" key to the SCHEMA that the serializer will assign in case the value is not required and not found. Should be quite straight forward too. |
Same issue here. I'v also set const _SCHEMA = {
...
"presences": {"name": "presences", "type": TYPE_ARRAY, "required": false, "content": "UserPresence"},
...
} |
This is fixed via #73 |
In my Godot client when i want to join the group chat i got this error:
NakamaException(StatusCode={-1}, Message=’{ERROR [Channel]: Missing or invalid required prop {content:UserPresence, name:presences, required:True, type:19} = Null:
{group_id:bf5052a9-948c-473b-b81e-ccf76d28126a, id:3.bf5052a9-948c-473b-b81e-ccf76d28126a…, self:{persistence:True, session_id:d2dd400b-22dc-11eb-8d0d-7106fdcb5b46, user_id:20a96d58-4d6f-4338-b487-2bfc10b7a43d, username:QdcBVBRWvL}}}’, GrpcStatusCode={-1})
The text was updated successfully, but these errors were encountered: