Skip to content

Commit 5d7b0fd

Browse files
andgenoTwoTenPvP
authored andcommitted
fix(docs): Fixed typos and example code of Named Messages (#253)
1 parent 69ff930 commit 5d7b0fd

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

docs/_docs/the-basics/messaging-system.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ title: Messaging System
33
permalink: /wiki/messaging-system/
44
---
55

6-
The MLAPI has two parts to it's messaging system. RPC messages and Custom Messages. Both types have sub types that change their behaviour, functionaliy and performance.
6+
The MLAPI has two parts to it's messaging system. RPC messages and Custom Messages. Both types have sub types that change their behaviour, functionality and performance.
77

88
### RPC Messages
99
RPC messages are the most common and easy to use type of message. There are two types of RPC messages. ServerRPC and ClientRPC. ServerRPC methods are invoked by clients (or host if there is no dedicated server) and runs on the Server and ClientRPC methods are invoked by the server but ran on one or more clients.
1010

1111
#### Modes
12-
The RPC methods can be used in two "modes". One is a performance mode where the code is a bit larger but it offers better performance. The other mode is the convenience mode. **The only difference between the two is that the convenience mode boxes all the values on the sender and receiver. If you don't know what that means, use the convenience mode otherwise you are most likley wasting your time.** The performance mode is designed for 100% performance as the MLAPI's goal is to be a general purpose networking library that is not to limit the games capabilities.
12+
The RPC methods can be used in two "modes". One is a performance mode where the code is a bit larger but it offers better performance. The other mode is the convenience mode. **The only difference between the two is that the convenience mode boxes all the values on the sender and receiver. If you don't know what that means, use the convenience mode otherwise you are most likely wasting your time.** The performance mode is designed for 100% performance as the MLAPI's goal is to be a general purpose networking library that is not to limit the games capabilities.
1313

1414
#### Ownership Checking
1515
By default, ServerRPC's can only be called if the local client owns the object the ServerRPC sits on. This can be disabled like this:
@@ -163,9 +163,9 @@ When the server has a local client (Host), ServerRPC's can be executed by that c
163163
ClientRPC's function the same way. When they are invoked, they are also invoked on the Host. This allows you to write the same code for the host and normal players.
164164

165165
### Custom Messages
166-
If you don't want to use the MLAPI's messaging. You don't have to. You can use a thin layer called "Custom Messages" (these can be used in combinaton with RPC messages aswell). Custom messages allows you to implement your own behaviour and add custom targeting etc. Custom messages are messages unbound to any game object.
166+
If you don't want to use the MLAPI's messaging. You don't have to. You can use a thin layer called "Custom Messages" (these can be used in combination with RPC messages as well). Custom messages allows you to implement your own behaviour and add custom targeting etc. Custom messages are messages unbound to any game object.
167167

168-
Custom messages comes in two forms, named and unnamed. Unnamed messages can be though of as a single sending channel. A message sent has one receive handler, this is useful for building your own custom messaging **system**. If you want a completed messaging system, you can use named messages. The receiver registers one listen handler for each message type, and the sender can choose what type to send.
168+
Custom messages comes in two forms, named and unnamed. Unnamed messages can be thought of as a single sending channel. A message sent has one receive handler, this is useful for building your own custom messaging **system**. If you want a completed messaging system, you can use named messages. The receiver registers one listen handler for each message type, and the sender can choose what type to send.
169169

170170

171171
#### Unnamed Messages
@@ -195,11 +195,12 @@ private void Start()
195195
private void Start()
196196
{
197197
//Receiving
198-
CustomMessagingManagerRegisterNamedMessageHandler("myMessageName", (senderClientId, stream)
198+
CustomMessagingManager.RegisterNamedMessageHandler("myMessageName", (senderClientId, stream)
199199
{
200200
using (PooledBitReader reader = PooledBitReader.Get(stream))
201201
{
202-
string message = reader.ReadString(); //Example
202+
StringBuilder stringBuilder = reader.ReadString(); //Example
203+
string message = stringBuilder.ToString();
203204
}
204205
});
205206

0 commit comments

Comments
 (0)