Protocol Version

  • 2 minutes to read

In VoltRpc, you can set a "protocol version". The value that you want to use for your protocol version has to be set on both the client and host. The value will then be checked when a client connects to a host, and if they are the same, then the connection will be approved, if not, then the connection will be refused.

The protocol version value can be any Type that has a TypeReadWriter<T> for it. This means custom Types can be used that has a custom TypeReadWriter<T> for it (see types for more info.)

Internally, VoltRpc uses the Equals(object) for comparison of values (VoltRpc will already check that the type sent by the client matches the host). Please remember this when using custom types.

Configuring

To set what protocol version you want to use, you will need to use SetProtocolVersion(object?) on the host, and SetProtocolVersion(object?) on the client.

Ideally, use a Type that has a small data size (such a byte).

When you are ready, you can change the protocol version value used by the host to stop all un-wanted connections from clients that have different protocol versions.