Modding:Network API: Difference between revisions

From Vintage Story Wiki
(Created page with "__FORCETOC__ == Introduction == In this example mod we will show you how to send custom data back and forth between the Server and the Client. To do this, we will set up a n...")
 
Line 25: Line 25:
</syntaxhighlight>
</syntaxhighlight>


The fields in these classes hold the data we wish to send through our channel. We'll use <code>NetworkApiTestMessage</code> to encase the initial message from the server, while NetWorkApiTestResponse will be used by the Client to send its response.
The fields in these classes hold the data we wish to send through our channel. We'll use <code>NetworkApiTestMessage</code> to encase the initial message from the server, while <code>NetWorkApiTestResponse</code> will be used by the Client to send its response.


Next, we'll set up our network channel on the server side, and register a server command to dispatch our message.
Next, we'll set up our network channel on the server side, and register a server command to dispatch our message.