WasmScripting
Networking API¶
Provides low-level message sending and receiving. Currently uses Mod Network and has no concept of ownership.
A proper high-level networking API is planned for a future update, built on top of this existing low-level API.
Static Members¶
Static Events¶
| Signature | Description |
|---|---|
| Action<Player, Span |
Invoked whenever a message is received |
Static Methods¶
| Signature | Description |
|---|---|
| void SendMessage(BufferReaderWriter writer, short[] playerIds = null, SendType sendType = SendType.Unreliable, bool loopback = false) | Sends a message using the given writer |
| void SendMessage(Span |
Sends a raw message |
| bool WillMessageBeDropped(int messageSize) | Returns true if a message of this size would be dropped |
| float NetworkCloggedPercentage() | Returns the network congestion percentage |
| int Ping | Current ping to the game server in ms |
| Player GetInstanceOwner() | Returns the instance owner player |
Example¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |