Communication Protocols#
kRPC provides four communication protocols:
Protocol Buffers over TCP/IP for languages that can communicate over a TCP/IP socket.
Protocol Buffers over a Local Socket for clients on the same machine as the game, which carries the same messages over a cheaper path than TCP/IP.
Protocol Buffers over WebSockets for web browsers.
Protocol Buffers over Serial IO for Arduino and similar.
In each protocol, clients invoke remote procedure calls by sending and receiving protobuf messages.
Protocol Version#
Each connection handshake carries the version of the protocol, an integer. The client sends the version it uses, and the server replies with the version it accepted:
Protocol version |
kRPC release |
Server accepts |
|---|---|---|
0 |
Before 0.7 |
Any version, which it ignores |
1 |
0.7 |
0 and 1 |
A client that sends no version is from before kRPC 0.7. The server serves it as version 1, and logs
a warning. The server rejects any other version with the status WRONG_PROTOCOL_VERSION, or
over WebSockets with HTTP status 400.