Can rpc() call a remote function on the server

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Help me please

Hi
I want to ask that if i call an rpc() from a client connected to a server then will it call the remote function on all peers (including server) or in all exept the server?


Does rpc() calls the remote function locally?

I’m pretty sure it will call it on the clients and the server.

Coxcopi | 2021-06-08 05:53

:bust_in_silhouette: Reply From: Wakatta

RPC will only call the function locally if you’ve set it to be that way using rset or the corresponding keywords

RPC will only call the function on peers that have been setup to receive such calls so if your code for the server is the same as the client then yes the server will also run the function

#will be called on all peers that has it
remote func rpc_function():
    pass

#will only be called by master peers
puppet func rpc_function():
    pass

#will be called on all peers(even server) and locally
remotesync func rpc_function():
    pass