Client vs Server region for Rpc calls

Hey gang

In this video we write the RpcLogNewName method in the #region Client. In a previous lecture a slide said [RpcClient] was when the server does something to all clients.

I know it doesn’t ultimately matter because it’s not going to affect how the code runs but this got me wondering about how we’re using our regions. Is the way we’ve set it up to be grouped by who it’s affecting or who’s calling it? Is there a “standard” generally on how developers expect regions to be grouped?

1 Like

@Nathan_Farrer

It is correct that the Server calls RPCs but they are then executed on the clients. It’s like a message to tell all clients to run the code so I think it’s best to put the code in the region where it will be executed.

1 Like

With respect to use of regions, there’s no real standard and it’s just for you to group things logically that can’t be directly inferred by the IDE or code you write.

As you may know; that allows you to reduce the on-screen clutter when the changes you do are likely to be contained in one place. There’s no other guiding principals really, even MS don’t have anything to say on the topic: #region - C# Reference | Microsoft Docs

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms