Node RPC methods

bloodlinebloodline Posts: 27Member

Why do the RPC functions return an empty variant? If the rpc functions can’t return any data, why do they return anything at all?

Comments

  • MegalomaniakMegalomaniak Posts: 2,654Admin

    I don't know but I'm guessing because nothing returned would just seem like a lost data/packet?

  • bloodlinebloodline Posts: 27Member
    edited June 28

    @Megalomaniak said:
    I don't know but I'm guessing because nothing returned would just seem like a lost data/packet?

    Does the the rpc call block the calling thread?

    I was hoping the RpcId() call would allow me to return data from the target peer...

    The Godot documentation regarding networking is really dreadful, and it’s not an easy topic to begin with!

  • bitshift-rbitshift-r Posts: 55Member

    The various rpc methods do not return anything. See this implementation of rpc_id. The return type is void - meaning no return type. However some private methods (e.g. _rpc_id_bind) return an empty variant - which doesn't seem to serve an apparent purpose as an empty variant is returned from all code paths.

    I suspect that an empty variant (void) return in GDScript is kind of like Python's implicit None... where even if a method does not explicitly return anything it still returns that implied None.

    And no - I don't believe that any of the rpc methods block. To get data back from the target peer they would have to invoke an rpc in response.

  • bloodlinebloodline Posts: 27Member

    Many thanks for explaining this to me!

    I need to rethink my network player architecture!

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file